Save signed document with password
Signature class supports saving signed document with password protection. This ability is supported over Password property of SaveOptions class that should be passed to Sign method.
Here are the steps to protect signed document with password with GroupDocs.Signature:
- Create new instance of Signature class and pass source document path or stream as a constructor parameter.
- Instantiate required signature options.
- Instantiate the SaveOptions object and specify Password property with required password string.
- Call Sign method of Signature class instance and pass signatureoptions and SaveOptions object to it.
Following example demonstrates how to save signed document with password.
using (Signature signature = new Signature("sample.pdf"))
{
// create QRCode option with predefined QRCode text
QrCodeSignOptions signOptions = new QrCodeSignOptions("JohnSmith")
{
// setup QRCode encoding type
EncodeType = QrCodeTypes.QR,
// set signature position
Left = 100,
Top = 100
};
SaveOptions saveOptions = new SaveOptions()
{
Password = "1234567890",
UseOriginalPassword = false
};
// sign document to file
signature.Sign("SignedProtected.pdf", signOptions, saveOptions);
}
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.