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
I was attempting to add a blank page every 3 pages for the purpose of splitting off letters for double-sided printing. In doing so Adobe would give me an error once I reached the second blank page.
I've isolated it to the blank pages being duplicated in the child list at the top of the pdf file. Since the blank pages themselves appear to generate properly, it appears to be an issue with where it generates the child element linkages for the document.
Notably I also learned that this is fixable by making sure every blank page has a unique size. If you use two unique sizes, it will error after reaching the first duplicated size.
Environment
Which environment were you using when you encountered the problem?
Python 3.10.0
Any PDF file appears to display this issue. Notably you need to load the file in adobe reader/acrobat. It loads fine in chrome, but Adobe Reader gives an error code of 14 and says it's expecting a dict object.
Binary file example
This is the correct code list of kids for my 10 letter document (40 pages total with the blank pages)
1 0 obj
<<
/Type /Pages
/Count 40
/Kids [ 3 0 R 4 0 R 5 0 R 6 0 R 7 0 R 8 0 R 9 0 R 10 0 R 11 0 R 12 0 R 13 0 R 14 0 R 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R 25 0 R 26 0 R 27 0 R 28 0 R 29 0 R 30 0 R 31 0 R 32 0 R 33 0 R 34 0 R 35 0 R 36 0 R 37 0 R 38 0 R 39 0 R 40 0 R 41 0 R 42 0 R ]
>>
endobj
This is the code that my script output for the 10 letter document (note all the 42 0 R repeats).
After modifying the 42 0 R to be a sequence instead of repeating (the objects that were created below were all correctly numbered, just not this child list), the pdf displayed fine:
<<
/Type /Pages
/Count 40
/Kids [ 3 0 R 4 0 R 5 0 R 42 0 R 7 0 R 8 0 R 9 0 R 42 0 R 11 0 R 12 0 R 13 0 R 42 0 R 15 0 R 16 0 R 17 0 R 42 0 R 19 0 R 20 0 R 21 0 R 42 0 R 23 0 R 24 0 R 25 0 R 42 0 R 27 0 R 28 0 R 29 0 R 42 0 R 31 0 R 32 0 R 33 0 R 42 0 R 35 0 R 36 0 R 37 0 R 42 0 R 39 0 R 40 0 R 41 0 R 42 0 R ]
>>
endobj
The text was updated successfully, but these errors were encountered:
I was attempting to add a blank page every 3 pages for the purpose of splitting off letters for double-sided printing. In doing so Adobe would give me an error once I reached the second blank page.
I've isolated it to the blank pages being duplicated in the child list at the top of the pdf file. Since the blank pages themselves appear to generate properly, it appears to be an issue with where it generates the child element linkages for the document.
Notably I also learned that this is fixable by making sure every blank page has a unique size. If you use two unique sizes, it will error after reaching the first duplicated size.
Environment
Which environment were you using when you encountered the problem?
Python 3.10.0
$ python -m platform Windows-10-10.0.19043-SP0 $ python -c "import PyPDF2;print(PyPDF2.__version__)" 2.5.0
Code + PDF
This is a minimal, complete example that shows the issue:
Any PDF file appears to display this issue. Notably you need to load the file in adobe reader/acrobat. It loads fine in chrome, but Adobe Reader gives an error code of 14 and says it's expecting a dict object.
Binary file example
This is the correct code list of kids for my 10 letter document (40 pages total with the blank pages)
This is the code that my script output for the 10 letter document (note all the 42 0 R repeats).
After modifying the 42 0 R to be a sequence instead of repeating (the objects that were created below were all correctly numbered, just not this child list), the pdf displayed fine:
The text was updated successfully, but these errors were encountered: