Sign document with ordering the signatures
GroupDocs.Signature provides with SignOptions property ZOrder that expects integer values as Z-order position. The signatures with a higher number of this property will be displayed above the others.
Here are the steps to manually adjust the ordering of signatures on the document page with GroupDocs.Signature:
- Create a new instance of Signature class and pass the source document path as a constructor parameter.
- Instantiate the SignOptions object with the required options and set the ZOrder property.
- Call Sign method of Signature class instance and pass SignOptions to it.
Sign document with Text signature
This example shows how to add Text signature to document.
using (Signature signature = new Signature("sample.pdf"))
{
TextSignOptions options = new TextSignOptions("John Smith")
{
// set signature position
Left = 100,
Top = 100,
// set signature rectangle
Width = 100,
Height = 30,
// set signature alignment
// when VerticalAlignment is set the Top coordinate will be ignored.
// Use Margin properties Top, Bottom to provide vertical offset
VerticalAlignment = Domain.VerticalAlignment.Top,
// when HorizontalAlignment is set the Left coordinate will be ignored.
// Use Margin properties Left, Right to provide horizontal offset
HorizontalAlignment = Domain.HorizontalAlignment.Right,
Margin = new Padding() { Top = 20, Right = 20 },
// adjust signature appearance
// setup signature border
Border = new Border()
{
Color = Color.DarkGreen,
DashStyle = DashStyle.DashLongDashDot,
Transparency = 0.5,
Visible = true,
Weight = 2
},
// set text color and Font
ForeColor = Color.Red,
Font = new SignatureFont { Size = 12, FamilyName = "Comic Sans MS" },
// setup background
Background = new Background()
{
Color = Color.LimeGreen,
Transparency = 0.5,
Brush = new LinearGradientBrush(Color.LimeGreen, Color.DarkGreen)
},
// set rotation
RotationAngle = 45,
// set alternative signature implementation on document page
SignatureImplementation = TextSignatureImplementation.Image
};
// set up shadow options for text
TextShadow shadow = new TextShadow();
shadow.Color = Color.OrangeRed;
shadow.Angle = 135;
shadow.Blur = 5;
shadow.Distance = 4;
shadow.Transparency = 0.2;
//add text shadow to signature extensions
options.Extensions.Add(shadow);
// specify Spreadsheet position over extension
options.Extensions.Add(new SpreadsheetPosition(10, 10));
// sign document to file
signature.Sign("signed.pdf", options);
}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Signature for .NET examples, plugins, and showcase
- GroupDocs.Signature for Java examples, plugins, and showcase
- Document Signature for .NET MVC UI Example
- Document Signature for .NET App WebForms UI Example
- Document Signature for Java App Dropwizard UI Example
- Document Signature for Java Spring UI Example
Free Online App
Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.