-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDFs protected from Adobe Acrobat online get corrupted when saved with lopdf #256
Comments
A relevant piece of info that I found while debugging it was that these files have v 4, r 4, which lopdf doesn't currently support for decryption (aes128). I added that support in my local branch of lopdf, but then found that the issue happens even with or without decryption. |
Hi @J-F-Liu I'm facing a similar issue. The file seems to have AES128 encryption but is not password protected. I'm hoping you can advise what sort of crypto capabilities lopdf has. I see pdf-rs seems to have some capabilities in this regard but those crates are not really dependable. Here's the debug out from the get_encrypted function performed on the Document struct: Here's the full debug output from the Document struct: |
@shantanugoel I've used the mupdf crate (a safe wrapper around mupdf) to create a function that cleans and removes encryption from these troublesome files. I'll just drop the code with full crate paths in case you would be open to a workaround until lopdf can handle this encryption.
This allows me to handle lopdf encryption errors by passing the file to the above function and the output back to lopdf. |
Any files password protected from Adobe acrobat online, fail to open in any pdf viewer after saving from lopdf, even if the operation is as simple as opening and then saving it without performing any other op on them.
The issue could be for any files generated by acrobat, but I dont have a paid account so can only test the ones I generated from their free protection offering.
test_protected.pdf
test_protected_lopdfsaved.pdf
test_orig.pdf
Attaching files:
The last file is corrupt. Password is "aaaaaa".
The files save well from other libs and utilities, with or without decrypting them, (I tried pdf-rs, qpdf, pdfium, etc)
The text was updated successfully, but these errors were encountered: