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
Dictionary with undefined indirect object and direct object for same key fails #325
Comments
…g them Entries with null values (either explicit or through references to nonexistent objects) are completely ignored and do not cause multiple definition errors if two entries are present for the same key and one has a null value. Fixes issue py-pdf#325 and proposes a behavior for issue py-pdf#236.
Can you share a PDF that causes the issue + code to show the issue? |
I guess this was an issue with a non-conformant PDF. As we don't have a good way to verify the issue / any solution without an example PDF file, I'll close this. Please let me know if you have one / a potential solution |
Sorry, I don't remember much about the details, it has been 5 years. There is a test case and example file that illustrates the issue. It contains a page dictionary with two |
attaching the test file from @rwirth (for local ref) I've checked the file with latest version and only a warning is reported. I've created a PR to check that |
no issue to be solved
Bug Fixes (BUG): - u_hash in AlgV4.compute_key (#1170) Robustness (ROB): - Fix loading of file from #134 (#1167) - Cope with empty DecodeParams (#1165) Documentation (DOC): - Typo in warning message (#1166) Maintenance (MAINT): - Package updates; solve mypy strict remarks (#1163) Testing (TST): - Add test from #325 (#1169) Full Changelog: 2.8.0...2.8.1
I have a PDF file with a funny-looking page dict (produced using pdfLaTeX):
The file is displayed just fine and running
pdfinfo
on it works without issues. When reading, PyPDF2 (strict mode) bails out withThe PDF 1.7 reference is not totally clear on this situation because on the one hand it states that [3.2.6]
and [3.2.7]
On the other hand it says that
One way of reading this is that the key referencing the nonexistent object should be treated as if it was absent from the dictionary, which is IMO the most sensible interpretation.
Also, the current implementation always keeps the first value so that the outcome (in nonstrict mode) depends on the order of the entries and one might end up with the indirect reference although there is a (valid) direct object present. This is also connected to issue #236.
The text was updated successfully, but these errors were encountered: