mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-25 10:39:01 -06:00
Page::rotation rounded a /Rotate that isn't a multiple of 90 down to a quarter turn (135 became 90), while the renderer draws such a page upright. Display size and the display-to-user-space matrix (header and footer, watermarks, measuring, printing, image signatures) then disagreed with the page on screen. ISO 32000-2 §7.7.3.3 requires a multiple of 90; read any other value as 0, as the renderer does. Page import and image stamps, which read /Rotate themselves, already treat such a value as 0. Test: rotate_off_a_quarter_turn_counts_as_upright (/Rotate 135, 30, -45, 359).
pdfcraft-model
Layer L2: typed views over the pdfcraft-cos object graph. It starts small, with what several
L3/L4 crates need:
pages(doc): leaf pages in order, each with its inherited attributes (Resources,MediaBox,CropBox,Rotate, §7.7.3.4) resolved;Page::crop,Page::rotation,Page::user_unitandPage::view_matrix: the displayed page's geometry, and the matrix from "display space" (points, origin at the bottom-left of the page as shown, after/UserUnitand/Rotate) to user space, so content can be placed the way the reader sees the page./UserUnitis read as Acrobat reads it: the page's own entry, a number from 1 up, at most 75,000; anything else counts as 1. A/Rotatethat isn't a multiple of 90 counts as 0, as the renderer draws it.view_matrix_for(rotation, rect)is the same matrix for any rectangle, e.g. to draw a comment's picture upright inside its user-space/Recton a turned page.
organize, annot and forms still carry their own small walkers; they move here as the model
grows (ADR-0004).