PDF file corrupted when decrypted

Hi,





We are working with Aspose.Pdf v7.7.0.0 and we have some issues to decrypt a pdf file (see attachment).





I try the following code and it worked well with some PDF :


try


{


PdfFileInfo fileInfo = new PdfFileInfo(documentToConvert);


Aspose.Pdf.Document doc = new Aspose.Pdf.Document(documentToConvert);





// determine that source PDF file is Encrypted with password


if (fileInfo.IsEncrypted)


{


doc.Decrypt();


}


doc.Save(“C:/Temp/newdoc.pdf”);


}


catch (Exception)


{


}





But for some reasons, it don’t work with some other PDF.


I got the following message when I try to open the file : "There was an error opening this document. There was a problem reading this document (109).





Someone as any hint for me ?





Thanks in advance

Hi Nicolas,

Thanks for using our API’s. I have tested the scenario using Aspose.Pdf for .NET 10.5.0 while using the following code snippet and I am unable to notice any issue. The PDF file is properly being displayed in Adobe Reader 11.0.3.

Please note that the source file does not have any open password but in order to perform any manipulation/modification, the password is required.

[C#]

PdfFileInfo fileInfo = new PdfFileInfo("c:/pdftest/t2151-fill-14e.pdf");
Aspose.Pdf.Document doc = new Aspose.Pdf.Document("c:/pdftest/t2151-fill-14e.pdf");

// determine that source PDF file is Encrypted with password
if (fileInfo.IsEncrypted)
{
    doc.Decrypt();
}

doc.Save("C:/pdftest/newdoc.pdf");

It work fine with Aspose.Pdf for .NET 10.5.0.

Thank you !

Hi Nicolas,


We are glad to hear that your problem is fixed in latest release. Please continue using our API’s and in the event of any further query, please feel free to contact.