#1296·pdf-lib

Cannot Load Encrypted/Restricted PDF Document

Author: conman805Created Aug 24, 2022Updated Jan 23, 2026
Labelsbugneeds-triage

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. (app-5e5bf3a8bd.js:16378:47) at step (app-5e5bf3a8bd.js:6812:23) at Object.next (app-5e5bf3a8bd.js:6793:53) at fulfilled (app-5e5bf3a8bd.js:6783:58)

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

  • My report includes a Short, Self Contained, Correct (Compilable) Example.
  • I have attached all PDFs, images, and other files needed to run my SSCCE.

Additional Notes

Similar to issue #291