eSign document with multiple signatures
GroupDocs.Signature allows to sign document with several signatures simultaneously and even apply signatures of different types to the same document. Doing this is as simple as:
- Create new instance of Signature class and pass source document path or stream as a constructor parameter.
- Instantiate required all required sign options objects dependent on signature type:
- BarcodeSignOptions - for Barcode signatures;
- DigitalSignOptions - for Digital signatures;
- FormFieldSignOptions - for Form-field signatures;
- ImageSignOptions - for Image signatures;
- MetadataSignOptions - for Metadata signatures;
- QrCodeSignOptions - for QR-code signatures
- StampSIgnOptions - for Stamp signatures;
- TextSignOptions - for Text signatures.
- Fill collection with sign options from previous step.
- Call Sign method of Signature class instance and pass collection of sign options to it.
This code snippet below demonstrates how to eSign PDF document with multiple signatures at the same time.
using (Signature signature = new Signature("sample.pdf"))
{
// define several signature options of different types and settings
TextSignOptions textOptions = new TextSignOptions("This is test message")
{
VerticalAlignment = VerticalAlignment.Top,
HorizontalAlignment = HorizontalAlignment.Left
};
BarcodeSignOptions barcodeOptions = new BarcodeSignOptions("123456")
{
EncodeType = BarcodeTypes.Code128,
Left = 100,
Top = 100
};
QrCodeSignOptions qrcodeOptions = new QrCodeSignOptions("JohnSmith")
{
EncodeType = QrCodeTypes.QR,
Left = 100,
Top = 200
};
DigitalSignOptions digitalOptions = new DigitalSignOptions("certificate.pfx")
{
ImageFilePath = Constants.ImageHandwrite,
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
Password = "1234567890"
};
// define list of signature options
List<SignOptions> listOptions = new List<SignOptions>();
listOptions.Add(textOptions);
listOptions.Add(barcodeOptions);
listOptions.Add(qrcodeOptions);
listOptions.Add(digitalOptions);
// sign document to file
signature.Sign("signed.pdf", listOptions);
Advanced Usage Topics
To learn more about document eSign features, please refer to the advanced usage section.
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.