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: