Repository navigation
BUG: Use the page top for a named destination instead of a fixed value - #4099
Merged
stefan6419846 merged 1 commit intoSep 17, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4099 +/- ##
=======================================
Coverage 98.09% 98.09%
=======================================
Files 59 59
Lines 11521 11523 +2
Branches 2151 2151
=======================================
+ Hits 11302 11304 +2
Misses 125 125
Partials 94 94 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
stefan6419846
approved these changes
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add_named_destination builds its destination array with a hardcoded /FitH top
of 826, whatever the page actually measures:
826 appears exactly once in the codebase and matches no page size. On US Letter
(792 units tall) it points 34 units above the top of the page, so the viewer
scrolls past the content instead of to it; on anything smaller the gap is
larger.
Per §12.3.2.2 the top operand of /FitH is the vertical coordinate positioned at
the top edge of the window, so it now reads the page's own mediabox top. Using
.top rather than the height also keeps it correct for a mediabox whose origin is
not at zero.
The existing test asserted /D[0] (the page reference) but never /D[2], which is
why the value went unnoticed; the new test covers Letter, A4, a small page and
an offset origin.
This is separate from #3522: that asks for a customisable fit type, which you
noted needs an API design since each fit takes different parameters. This only
corrects the top value of the existing /FitH behaviour.
Offline suite passes, 1367 tests.
Used Claude (Opus) to help locate and patch this; I reviewed and tested the change.