Posted by a ceTe Software moderator
Hello Sudhakar,
If you are setting security and also adding digital signature to the existing PDF then you will need to do both before you draw the PDF. If you are adding signature first and drawing PDF and again merging it for setting security, then it will invalidate the signature. Below is the code sample for adding signature and setting security to the existing PDF using Merger product.
PdfDocument pdf = new PdfDocument("path for input PDF");
MergeDocument document = new MergeDocument(pdf);
Signature signature2 = new Signature("MySigField", 10, 10, 300, 100);
document.Pages[0].Elements.Add(signature2);
Certificate certificate2 = new Certificate(@"Path for certificate file", "password");
document.Sign("MySigField", certificate2);
//Code for setting security.
HighSecurity security = new HighSecurity("owner", "user");
document.Security = security;
document.Draw("C:/Temp/MyDocument.pdf");
Thanks,
ceTe Software Support Team.