Skip to content

Convert TOC y through CropBox origin, not crop height - #5111

Open
gyanu2507 wants to merge 1 commit into
pymupdf:mainfrom
gyanu2507:fix/set-toc-cropbox-y
Open

gyanu2507 wants to merge 1 commit into
pymupdf:mainfrom
gyanu2507:fix/set-toc-cropbox-y

Conversation

@gyanu2507

@gyanu2507 gyanu2507 commented Sep 6, 2026

Copy link
Copy Markdown

set_toc converted a y value with cropbox.height - y. PDF destinations live in default user space (MediaBox), so when CropBox is shifted the round-trip from get_toc was off by CropBox.y0.

The conversion now uses cropbox.y1 - y, which is the same as before when CropBox matches MediaBox.

Fixes #4484

set_toc treated the y as relative to a crop box whose origin is (0, 0).
PDF destinations are in default user space, so a shifted CropBox
offset the round-trip by CropBox.y0.

Fixes pymupdf#4484
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@gyanu2507

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Sep 17, 2026
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

Successfully merging this pull request may close these issues.

set_toc does not correctly set y-positions

1 participant