Sign document with Digital signature - advanced
GroupDocs.Signature provides DigitalSignOptions class to specify different amount of settings for Digital signature
- digital certificate (file on local disk CertificateFilePath or stream CertificateStream) (required)
- password of digital certificate Password (required)
- digital signature details (Reason, Contact, Location)
- signature image as digital signature appearance on document page (ImageFilePath or ImageStream)
- image signature appearance on document page (Alignment, Margin etc.)
Here are the steps to add Digital signature into document with GroupDocs.Signature:
- Create new instance of Signature class and pass source document path as a constructor parameter.
- Instantiate the DigitalSignOptions object with required certificate and its password.
- Call Sign method of Signature class instance and pass DigitalSignOptions to it.
- Analyze SignResult result to check newly created signatures if needed.
This example shows how to add Digital signature to document. See SignResult
using (Signature signature = new Signature("sample.pdf"))
{
// initialize digital option with certificate file path
DigitalSignOptions options = new DigitalSignOptions("certificate.pfx")
{
// certifiate password
Password = "1234567890",
// digital certificate details
Reason = "Sign",
Contact = "JohnSmith",
Location = "Office1",
// image as digital certificate appearance on document pages
ImageFilePath = "sample.jpg",
//
AllPages = true,
Width = 80,
Height = 60,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Right,
Margin = new Padding() { Bottom = 10, Right = 10},
};
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.