-
-
Notifications
You must be signed in to change notification settings - Fork 628
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
Expected instance of PDFDict, but got instance of undefined #1260
Comments
+1 |
2 similar comments
+1 |
+1 |
Hello, I have the same issue and can't figure out what's the problem.
|
+1 |
|
Here is an issue with an example PDF that causes this error: I hope this helps! |
I was having the same issue, and it was due to PDFs not being PDF/A compliant. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
This is likely due to the pdfs being encrypted. You can tell by the I'm having the same issue with my encrypted/secured pdfs. NOTE: Just because it's a secure pdf, doesn't mean it necessarily requires a password. Here is an example from my PDF:
Depending on your use case you may be able to use a fork of this repo as described here since that appears to have encrypted pdf support: #1616 I haven't figured out a good solution for this at scale, but if it's a small batch of pdfs, you can probably open them in a pdf reader, then print as a pdf to make a new one, then run your processing on that. |
What were you trying to do?
Getting indices, pages or a page by index throws this error. Cant share the document but because of sensitive data. It has Page Extraction: Not Allowed and Document Assembly: Not Allowed but that doesn't prevent other PDFs working just fine.
How did you attempt to do it?
Simple and straight forward
What actually happened?
Works most of the time but invoice PDFs from a specific client are not ok. It always throws
Expected instance of PDFDict, but got instance of undefined
when this
const pageIndices = attachedPDF.getPageIndices();
or this
const pages = attachedPDF.getPages();
is executed...
If I open it in Edge and add some text and save it as changed doc. The changed doc works without issues.
What did you expect to happen?
Get information about pages.
How can we reproduce the issue?
I can not make the document public as its an invoice but can ask for permission to send it privately if necessary. Editing information fixes the issue which makes it hard to erase sensitive data. e.g. Editing in MS Edge (just adding text) fixes the issue.
Version
1.17.1
What environment are you running pdf-lib in?
Browser
Checklist
Additional Notes
No response
The text was updated successfully, but these errors were encountered: