Adding signature to password protected PDF

Hi,


I have the need to password protect and sign some PDF’s. I’ve managed to find some examples to password protect and digitally sign, but I’m unable to perform them together.

I have the following code to password protect

Dim document As New Aspose.Pdf.Document("Source.pdf")
document.Encrypt("user", "owner", 0, Aspose.Pdf.CryptoAlgorithm.AESx128)
document.Save("PasswordProtected.pdf")

and the following to sign

Dim pdfSign As Aspose.Pdf.Kit.PdfFileSignature = New Aspose.Pdf.Kit.PdfFileSignature(srcPDF, dstPDF)
Dim signature7 = New Aspose.Pdf.Kit.Pkcs7Signature("Metrofile")
signature7.Reason = "Pkcs7 Signature Example"
signature7.Date = Now
pdfSign.Sign(1, False, New System.Drawing.Rectangle(100, 400, 200, 500), signature7)
pdfSign.Save()

I need to know how to perform this preferably in one pass, or if I can't do it in one pass then how do I open a password protected pdf in the second code example?
Many thanks
Wayne

Hi Wayne,


Thanks for your inquiry. After initial investigation, I’ve logged a issue as PDFNEWNET-35571 in our issue tracking system for further investigation. We will keep you updated about the issue progress via this forum thread.

Sorry for the inconvenience faced.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-35571) have been fixed in Aspose.Pdf for .NET 9.1.0.

For further details, you may check this blog post.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.