Open nicolassanmar opened 2 weeks ago
I think I solved this issue by loading the documents by passing an empty password to the load options:
await PDFDocument.load(pdfBytes, {
throwOnInvalidObject: true,
ignoreEncryption: true,
password: '',
}),
This is confusing, as I would expect that doing this is not necessary for documents that do not have a password
What were you trying to do?
I was trying to load a document using
PDFDocument.load
, but it threw this Error. The PDF document can be loaded without any issues onpdf.js
and in other PDF readers. Here is a sample document that fails to load here:sample.pdf
How did you attempt to do it?
I downloaded my document from Adobe Sign, then uploaded it to the webapp where
pdf-lib
is available. I then wanted to edit it usingpdf-lib
, for which I loaded the document withPDFDocument.load
as I do for any other document. This throws the error:Allowing
ignoreEncryption
does not fix this issue, as it prevents the document from being parsed properly (it returns all blank pages).What actually happened?
I got the error mentioned above.
What did you expect to happen?
I expected the document to load without any issues into
pdf-lib
. I expected this to work as I saw this comment here, stating that this fork should have fixed the issue: https://github.com/Hopding/pdf-lib/issues/1601#issuecomment-2126845851How can we reproduce the issue?
Just run
PDFDocument.load()
over the document I shared above (which I will share here as well).4ffefced-d7bc-4b46-bead-28cd1710534b original.pdf
Version
2.2.3
What environment are you running pdf-lib in?
Browser
Checklist
Additional Notes
No response