Error referencing a non-existent page destination when writing PDF #2842
Labels
is-robustness-issue
From a users perspective, this is about robustness
PdfWriter
The PdfWriter component is affected
Errors occur in the PDF writing process.
Environment
Which environment were you using when you encountered the problem?
Code + PDF
This is a minimal, complete example that shows the issue:
Sorry we are unable to provide the PDF.
We are in the process of confirming that we can create a PDF that can be published without any problems.
Traceback
This is the complete traceback I see:
Perhaps the following are causing the problem.
46 0 obj
and20 0 obj
do not exist.I tried to fix them in Adobe Acrobat, but could not figure out how to turn them off.
When read in PdfReader, the following will be generated in
named_destinations
. (pdf has only one page)I was able to avoid the error by adding
if len(reader.pages) > dest[“/Page”]:
on the PdfWriter side.pypdf/pypdf/_writer.py
Lines 2471 to 2482 in 8f62120
A Dests reference is created in the resulting PDF as follows.
The text was updated successfully, but these errors were encountered: