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(Signaturesignature=newSignature("sample.pdf")){// create QRCode option with predefined QRCode textQrCodeSignOptionssignOptions=newQrCodeSignOptions("JohnSmith"){// setup QRCode encoding typeEncodeType=QrCodeTypes.QR,// set signature positionLeft=100,Top=100};SaveOptionssaveOptions=newSaveOptions(){Password="1234567890",UseOriginalPassword=false};// sign document to filesignature.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: