What were you trying to do?
Get the attachment files of a PDF document
How did you attempt to do it?
I loaded a PDF with an attachment that doesn't have a description.
Then, I ran doc.getAttachments() but it generated an exception.
What actually happened?
An exception is raised
Uncaught (in promise) TypeError: t.lookup(...) is undefined
getSavedAttachments PDFDocument.js:878
getSavedAttachments PDFDocument.js:845
getAttachments PDFDocument.js:913
genpdf test.html:25
onclick test.html:1
PDFDocument.js:878:41
What did you expect to happen?
Successfully getting the pdf attachments. If the attachment has an associated description, the code is working as intended.
How can we reproduce the issue?
Here's a simple html page demontrating the issue: test.zip
You can generate a simple pdf with an attachment (with or without description).
After having saved a file, you can try to load it with the input element (this is because the attachments that are freshly added by pdf-lib aren't handled the same way).
In the console, you can see that a document whose attachment has a description is loaded fine while the ones that don't have a description raise an Exception.
Version
2.4.1
What environment are you running pdf-lib in?
Browser
Checklist
Additional Notes
No response
What were you trying to do?
Get the attachment files of a PDF document
How did you attempt to do it?
I loaded a PDF with an attachment that doesn't have a description.
Then, I ran
doc.getAttachments()but it generated an exception.What actually happened?
An exception is raised
What did you expect to happen?
Successfully getting the pdf attachments. If the attachment has an associated description, the code is working as intended.
How can we reproduce the issue?
Here's a simple html page demontrating the issue: test.zip
You can generate a simple pdf with an attachment (with or without description).
After having saved a file, you can try to load it with the input element (this is because the attachments that are freshly added by pdf-lib aren't handled the same way).
In the console, you can see that a document whose attachment has a description is loaded fine while the ones that don't have a description raise an Exception.
Version
2.4.1
What environment are you running pdf-lib in?
Browser
Checklist
Additional Notes
No response