Skip to content
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

Document::page_iter misses pages if Kids array is an indirect reference #373

Open
zyxw59 opened this issue Jan 20, 2025 · 1 comment
Open

Comments

@zyxw59
Copy link

zyxw59 commented Jan 20, 2025

lopdf version: 0.35.0

If a page table in the document has an indirect reference for its Kids array, that reference will not be followed, so those children in the page tree will be skipped.

I've attached a minimal document which renders correctly with one page in a PDF viewer, but Document::page_iter will return no pages

test.pdf

@zyxw59
Copy link
Author

zyxw59 commented Jan 20, 2025

I think the fix for this is just changing

.and_then(|page_tree| page_tree.get(b"Kids"))
to use page_tree.get_deref(b"Kids", doc) instead of page_tree.get(b"Kids")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant