Skip to content

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

Merged
julian-smith-artifex-com merged 1 commit into
pymupdf:mainfrom
gyanu2507:fix/set-toc-cropbox-y
Nov 3, 2026
Merged

julian-smith-artifex-com merged 1 commit into
pymupdf:mainfrom
gyanu2507:fix/set-toc-cropbox-y

Conversation

@gyanu2507

@gyanu2507 gyanu2507 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

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

@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
Contributor 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
@julian-smith-artifex-com

Copy link
Copy Markdown
Collaborator

We can't look at merging this because it is failing tests. Could you take a look?

Otherwise we'll close this PR soon.

@gyanu2507

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and reapplied the CropBox TOC fix.

The earlier CI failure in test_3569 was an unrelated MuPDF warning-string drift (mapping via ) → mapping via Adobe-Identity-UCS)), already fixed on main. This branch no longer carries the stale expectation.

@gyanu2507
gyanu2507 force-pushed the fix/set-toc-cropbox-y branch from 2393e77 to 2e6c025 Compare October 28, 2026 14:41
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.

Rebased onto current main so CI picks up the updated MuPDF warning
expectations in test_3569.

Fixes #4484
@julian-smith-artifex-com
julian-smith-artifex-com merged commit c78ec42 into pymupdf:main Nov 3, 2026
3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
@julian-smith-artifex-com

Copy link
Copy Markdown
Collaborator

This PR is now merged. Many thanks for submitting it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set_toc does not correctly set y-positions

3 participants