You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Could not find page for PDFRef 220 0 R
at PDFForm.findWidgetPage (/home/roman/Projects/monorepo/packages/lambdas/pdfService/node_modules/pdf-lib/cjs/api/form/PDFForm.js:603:23)
at PDFForm.flatten (/home/roman/Projects/monorepo/packages/lambdas/pdfService/node_modules/pdf-lib/cjs/api/form/PDFForm.js:458:33)
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
In our project I have around 30 different pdfs and only 2 has such issue. Not sure if it's corrupted metadata or something else. Before it was working with pdftk.
The text was updated successfully, but these errors were encountered:
makarov-roman
changed the title
Could not find page for PDFRef Error why during flatten
Could not find page for PDFRef Error during flatten
Jul 20, 2022
I've made minor patch to ignore this error inside flatten and findWidgetPage functions and result doc look fine. So my assumption is that some editor left broken meta-data, thus pdflib "see" widget, but cannot find it on page. Ideally we should check it during load and clean such broken widgets/refs.
I'll publish the workaround tomorrow.
here is my workaround
you can test it via @visaright/pdf-lib npm package. (you can use package with caution, cause it will be removed after the issue is properly fixed in the mainstream)
emilsedgh
added a commit
to emilsedgh/pdf-lib
that referenced
this issue
Feb 26, 2023
that couldn't be found on any pages. Up until now we've been throwing
an exception when dealing with such fields. But it appears that other
PDF software are more resilient to this and gracefully ignore them.
This commit ensures we'll do the same.
FixesHopding#967,Hopding#1281,Hopding#1349
What were you trying to do?
flatten document.
How did you attempt to do it?
example to reproduce below
What actually happened?
crash on flatten call
What did you expect to happen?
not having a crash
How can we reproduce the issue?
file
Version
1.17.1
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
In our project I have around 30 different pdfs and only 2 has such issue. Not sure if it's corrupted metadata or something else. Before it was working with pdftk.
The text was updated successfully, but these errors were encountered: