Error Decrypting PDF With Acrobat Reader

We are taking a few existing .pdf files and combining them into 1 using the following code:

        public void combinePDF(string input1, string input2, string output) {
            Aspose.Pdf.License imageListLicence = new Aspose.Pdf.License();
            imageListLicence.SetLicense("Aspose.Total.lic");
            //open first document
            Document pdfDocument1 = new Document(input1);
            //open second document
            Document pdfDocument2 = new Document(input2);
        <SPAN style="COLOR: green">//add pages of second document to the first</SPAN>
        pdfDocument1.Pages.Add(pdfDocument2.Pages);

        <SPAN style="COLOR: green">//save concatenated output file</SPAN>
        pdfDocument1.Save(output);            
    }</PRE>

At the end of the process, we then encrypt the file:

        public void encryptPDF(string fileName, string newFileName, string userPassword, string ownerPassword) {
            Aspose.Pdf.License imageListLicence = new Aspose.Pdf.License();
            imageListLicence.SetLicense("Aspose.Total.lic");
            //open PDF document
            PdfFileSecurity fileSecurity = new PdfFileSecurity(fileName, newFileName);
            //change password
            fileSecurity.EncryptFile(userPassword, ownerPassword, DocumentPrivilege.Print, KeySize.x256); ;
        }

The issue is, there are many Acrobat Reader machines that are having issues decrypting the .pdf file at the end. Acrobat Pro seems to be ok, but the free versions are receiving either errors that Adobe can not decrypt the file, or the program just errors out.

Anyone seen this before? Was wondering if it had to do with the KeySize.x256, but if we create a .pdf from scratch with multiple images, they can open the file ok.

Thanks in advance for your help.

Hi Jesse,


Thanks for contacting support.

I have tested the scenario where I have used Aspose.Pdf for .NET 7.9.0 to concatenate two sample PDF files in Visual Studio 2010 application running over Windows 7 (X64) and then I have applied encryption over concatenated file using PdfFileSecurity object. When viewing the resultant encrypted file in Adobe Reader 11.0.2, I provided the required password and I am able to view the file without any error.

Can you please share which version of Aspose.Pdf for .NET you are using and also please share some details regarding your working environment. We are sorry for this inconvenience.


PS, I would also suggest you to call fileSecurity.Close(); method in encryptPDF(…) function.

The issue is definitely with the Encryption sizing....the users are using Acrobat 8 and can't get it upgraded quickly. When we create the .pdf file with 256 encryption, they can't open them, but when we move it down to 128, it works just fine.

Just an FYI in case anyone else runs into this issue.

Hi Jesse,


Thanks for your inquiry. It seems the issue relates to Adobe Reader 8.0 encryption algorithm related issue. However, I’ve logged a ticket PDFNEWNET-35240 in our issue tracking system for further investigation. We will keep you updated about our findings via this forum thread.

Sorry for the inconvenience faced.

Best Regards,

Hi Jesse,


After further investigation, we’ve found that its Acrobat Reader 8 limitation. It doesn’t support AESx256 encryption and you will have to upgrade your Adobe Reader version for the feature. Please check following link for reference.


http://helpx.adobe.com/acrobat/using/securing-pdfs-passwords.html


Please feel free to contact us for any further assistance.


Best Regards,