How to fix cannot find page in page tree error? #1757
-
I have a project that was working well for the last 6 months and recently I've started to get some The project takes a PDF from emails and merges it into a master PDF for a range of different healthcare clients. The same issue happens if I try to key into the doc at the relevant page number (for example doc[10] might throw the error "cannot find page 11 in page tree". I tried googling the questions and referencing the docs but have been unable to find relevant information. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 23 replies
-
These PDFs contain internal errors. The page tree can be a tree-like structure, but often also is just an array of cross reference numbers. That object is referenced by the |
Beta Was this translation helpful? Give feedback.
-
For background reading look at this. Your catalog / page tree has an invalid entry |
Beta Was this translation helpful? Give feedback.
-
A |
Beta Was this translation helpful? Give feedback.
-
I read through the suggested materials and did fairly extensive googling but can't find anything about why my PDF has a /Types. I suspect that this is the issue causing the page tree to break. Is there low level code or a part of this repos codebase that I can look at to understand how the PDF is being built and interacted with? I was wondering if there is a way to identify why the /Types is happening. If not, totally understand and I appreciate the answers to my questions. |
Beta Was this translation helpful? Give feedback.
-
Just wanted to close this out and say thank you, doing the save + linear=True resolved my issue |
Beta Was this translation helpful? Give feedback.
These PDFs contain internal errors. The page tree can be a tree-like structure, but often also is just an array of cross reference numbers. That object is referenced by the
/Pages
key in the PDF catalog. The structure it is pointing to is corrupt for whatever reason.There is no way to heal this except saving it with the maximum of garbage collection option
garbage=4
and hope that this will rebuild the document.