pdf-lib
pdf-lib copied to clipboard
Cannot Load Encrypted/Restricted PDF Document
What were you trying to do?
I am unable to load an encrypted document in PDF-lib.
We would ideally like to be able to list out the pages and or make changes to a PDF document even if a permission password is present.
How did you attempt to do it?
samplesecured_256bitaes_pdf.pdf
We triad to call the load function on the attached document.
What actually happened?
We got the below error. However, even when calling load with the specified ignore encryption option, there is a different error that occurs (probably due to lack of support).
Uncaught (in promise) Error: Input document to PDFDocument.load is encrypted. You can use PDFDocument.load(..., { ignoreEncryption: true }) if you wish to load the document anyways.
at new EncryptedPDFError (app-5e5bf3a8bd.js:20517:24)
at new PDFDocument (app-5e5bf3a8bd.js:16306:19)
at Function.
What did you expect to happen?
The document should load in the library and be able to be manipulated. I am fine if this requires an extra param or setting to enable for encrypted or otherwise protected documents.
Is this functionality on the roadmap or can it be added? What is needed to support the default password and does it apply to my example? https://github.com/Hopding/pdf-lib/issues/134#issuecomment-509452191
How can we reproduce the issue?
PDFDocument.load(filestream).then(function (pdfDoc) {
});
Sample PDF - samplesecured_256bitaes_pdf.pdf
Version
1.17.1
What environment are you running pdf-lib in?
Browser
Checklist
- [X] My report includes a Short, Self Contained, Correct (Compilable) Example.
- [X] I have attached all PDFs, images, and other files needed to run my SSCCE.
Additional Notes
Similar to issue #291
im facing same problem. I just want to process default encrypted PDFs.
im facing same problem. I just want to remove default open password from a pdf
I have the same use case: Decrypting PDFs (with their respective password) to remove the password requirement from the original files.
interesting workaround when I was facing a problem being unable to fill a pdf because it had encryption (was readable, but couldn't read or fill form fields) - try printing the PDF to another PDF using chrome, then load that printed one into pdf-lib, the fields will remain but the security settings will be removed.
Why can't we process default encrypted PDFs with this library yet?
Does anyone know of a similar library that has this feature?
You can use PDF.js it supports default encryption.
On Thu, Sep 7, 2023 at 10:09 PM brianarpie-forme @.***> wrote:
Why can't we process default encrypted PDFs with this library yet?
Does anyone know of a similar library that has this feature?
— Reply to this email directly, view it on GitHub https://github.com/Hopding/pdf-lib/issues/1296#issuecomment-1710469589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEUIPOS422Y2NNIK6YBXFNDXZH2C3ANCNFSM57QUB6DQ . You are receiving this because you commented.Message ID: @.***>