Repository navigation
Scale a page's display space by its /UserUnit (#729) - #737
Merged
Merged
Conversation
Display coordinates are points of 1/72 inch, as the owner decided on 2026-11-07. A page with a [0 0 400 300] MediaBox and /UserUnit 2 is 800 by 600 points: its boxes, text and paths, clips, annotation and link rectangles, canvas, and OCR layer use those points, and it renders 800 by 600 pixels at 72 dpi. pyropdf_store::pages::user_unit is the one rule (a finite number above 0, else 1; not inherited). The store's Page and the engine's new display module both apply it, so geometry and rendering share one conversion. The SVG's width and height are in points; its viewBox stays in user space units. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks
yhay81
commented
Nov 7, 2026
yhay81
left a comment
Owner
Author
There was a problem hiding this comment.
I recommend fixing the four coordinate errors and the two unbudgeted copies below before merging. I reproduced the coordinate errors on 8e111a7b through the public Python API. All 433 tests in the ten related test modules passed locally, and the current head passed CI.
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.
Closes #729
A page's
/UserUnitscales its display coordinates to physical points (1/72 inch), following the owner's decision. A page with/MediaBox [0 0 400 300] /UserUnit 2measures 800 by 600 points and renders at 800 by 600 pixels at 72 dpi.What changed
/UserUnitthrough the store. Missing or invalid values use 1. For a reference chain it records each object read, so editing the last object updates derived geometry. Invalid containers are never copied for the unit._core.page_spacereturns(rotation, box, unit)and_core.canvas_source_pagecarries the unit after the box.Acceptance
Checks
python3 tools/check.py --lockedpassed on89287512. The Python suite passed 8,205 tests and the Rust workspace passed 665 tests. Ruff, ty, rustfmt and Clippy also passed.Follow-up
Not a port from pylopdf.