We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Encrypted PDFs - PdfFileInfo & PdfExtractor

Hi,

I am testing with two different password-protected PDF files (simple protection). One was created on a Mac (using Mac’s native PDF ability), and one was created on a PC using PDF Creator. Both open in Adobe Reader, and both allow for user to copy text. I am using Aspose.Pdf.Kit version 5.0.0.1. If these problems are solved by a later version, I would be glad to upgrade (I looked at some of the release notes, and I didn’t see anything that indicates that these issues have been resolved).

The PC-created file cannot be opened by PdfFileInfo (using either stream or file), resulting in an exception thrown by the constructor (“Bad password!: v5.0.0.1”) while the Mac one can. The Mac one, however, can bind to it with PdfExtractor, but ExtractText and ExtractAttachment both throw an exception (“The input file was encrypted and no or invalid password has been specified.”).

For a different reason entirely, I was also trying to add the ability to save a version of an encrypted PDF file in unencrypted form using PdfFileSecurity, which happens to allow me to bypass this problem by using the stream output from this class to feed it into the other classes, but I prefer to not have to rely on this. (By the way, is this the best way to save a protected PDF file as unprotected?). Also, PdfFileSecurity cannot open the file that was created on the PC. I hope that the PC file is just a random problem, but I am not sure why the Mac-created file could not have its text or attachments extracted.

Thanks!

Daniel

Hi Daniel,

First off, you may try using the latest version at your end. You can also try to decrypt the PDF files using empty password and then further use those files. However, if that doesn’t help then please share the input PDF files, so we could investigate your issues at our end and guide you accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Shahzad,

Thanks for the recommendation. I tried with the latest PDF Kit version (5.5.0.0), but with no change in behavior. I’ve attached a zip file with two PDF files (and a text file with the password), for your team to try to open.

Thanks,
Daniel

Hi Daniel,

Thank you very much for sharing the sample files.

I have reproduced these issues at my end and logged them as shown below:

PC File:

PDFKITNET-26677 - PdfFileInfo throws ‘bad password’ exception even when the password is correct
PDFKITNET-26678 - ExtractText method throws invalid password exception 1
PDFKITNET-26680 - ExtractAttachment throws bad password exception 1

Mac File:

PDFKITNET-26679 - ExtractText method throws invalid password exception 2
PDFKITNET-26681 - ExtractAttachment throws bad password exception 2

Our team will investigate these issues in detail and you’ll be updated via this forum thread once they’re resolved.

We’re sorry for the inconvenience.
Regards,

Hi,

Is there any progress/ETA on fixes to these issues? I've tested with the latest version (5.6.0.0), and there's been no difference in behavior.

Also, I've noticed similar problems when attempted to extract text from PDF documents that aren't protected on the file level, but have some capabilities disabled (printing and/or copying). I assume this is related to the previous bugs.

Thanks,
Daniel

Hi Daniel,

I’m sorry to inform you that these issues are not yet resolved. However, I have asked our team to share the ETA of these issues and you’ll be updated via this forum thread as soon as the response is received.

We’re sorry for the inconvenience.
Regards,