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

Convert TOC y through CropBox origin, not crop height#5111
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


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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