Browse / github.com/storytold/pdfcraft / patch
M10: preserve NoRotate appearance geometry in vector printing
Vector printing rotates and moves existing NoRotate annotation appearances Vector printing converts an existing NoRotate annotation appearance into page artwork without compensating for the source page's rotation. The saved print PDF changes its orientation and position. Reproduced on current `main` `1dd2737b47a9c1c9562f0af563053d1bf510e4bf`, with the two published #4969 build prerequisites. The contributor-original fixture has no fonts or external assets: ```text Page: /MediaBox [0 0 240 320] /Rotate 90 Annotation: /Subtype /Square /F 20 /Rect [90 130 170 190] /AP << /N 6 0 R >> Appearance: /Type /XObject /Subtype /Form /BBox [0 0 80 60] /Resources << >> 0 1 1 rg
- Status
- open
- Score
- 0.00
- Adopters
- 0 other operators
- Author
- KyleKassen (imported from pull request #5036, open)
- Base
e9fc890a862ea2d8c895ea32ddecda98580483cd- Size
- +511 −42 in 14 files
- Review
- pending
- Shared
- 2026-10-28
- Id
144b1d97087fcc6a927f273a
How it went
No other operator has reported using it yet.
Diff
raw · ATTRIBUTION.md ATTRIBUTION.toml Cargo.lock Cargo.toml ROADMAP.md crates/ocr/Cargo.toml crates/ocr/src/lib.rs crates/print/README.md crates/print/src/imposition.rs crates/print/src/tests/appearances.rs docs/releasing.md docs/roadmap.md packaging/windows/test-msi.ps1 parity/acrobat-features.toml
@@ -335,8 +335,8 @@ Fonts are fetched by `cargo xtask demo-pdf` into `target/demo-fonts/`, OCR model | `NotoColorEmoji-Regular.ttf` | Noto Color Emoji | Google Inc. | OFL-1.1 | https://github.com/google/fonts/tree/9710da1eacb3be272583c3224dcb70f9da6eadbb/ofl/notocoloremoji | Showcase PDF (cargo xtask demo-pdf) | | `Inter[opsz,wght].ttf` | Inter (variable) | The Inter Project Authors (Rasmus Andersson) | OFL-1.1 | https://github.com/google/fonts/tree/9710da1eacb3be272583c3224dcb70f9da6eadbb/ofl/inter | Showcase PDF (cargo xtask demo-pdf) | | `Inter-Italic[opsz,wght].ttf` | Inter Italic (variable) | The Inter Project Authors (Rasmus Andersson) | OFL-1.1 | https://github.com/google/fonts/tree/9710da1eacb3be272583c3224dcb70f9da6eadbb/ofl/inter | Showcase PDF (cargo xtask demo-pdf) |-| `text-detection.rten` | Ocrs text detection model | Robert Knight (ocrs-models; trained on HierText, CC-BY-SA-4.0) | CC-BY-SA-4.0 | https://github.com/robertknight/ocrs-models (the models ocrs downloads; model card: https://huggingface.co/robertknight/ocrs, cc-by-sa-4.0) | Scan & OCR: finds words on page images (cargo xtask models) |-| `text-recognition.rten` | Ocrs text recognition model | Robert Knight (ocrs-models; trained on HierText, CC-BY-SA-4.0) | CC-BY-SA-4.0 | https://github.com/robertknight/ocrs-models (the models ocrs downloads; model card: https://huggingface.co/robertknight/ocrs, cc-by-sa-4.0) | Scan & OCR: reads the words it finds (cargo xtask models) |+| `text-detection.onnx` | Ocrs text detection model | Robert Knight (ocrs-models; trained on HierText, CC-BY-SA-4.0) | CC-BY-SA-4.0 | https://github.com/robertknight/ocrs/blob/0c826441362a701c55560fefc17bf356b6d1037e/ocrs/examples/download-models.sh (author-published ONNX models; model card: https://huggingface.co/robertknight/ocrs/blob/df0edd170279ab971b53e094c627255a87e1a503/README.md, cc-by-sa-4.0) | Scan & OCR: finds words on page images (cargo xtask models) |+| `text-recognition.onnx` | Ocrs text recognition model | Robert Knight (ocrs-models; trained on HierText, CC-BY-SA-4.0) | CC-BY-SA-4.0 | https://github.com/robertknight/ocrs/blob/0c826441362a701c55560fefc17bf356b6d1037e/ocrs/examples/download-models.sh (author-published ONNX models; model card: https://huggingface.co/robertknight/ocrs/blob/df0edd170279ab971b53e094c627255a87e1a503/README.md, cc-by-sa-4.0) | Scan & OCR: reads the words it finds (cargo xtask models) | ## Optional build inputs (1) @@ -3356,30 +3356,30 @@ usage = "1x + 2x HiDPI 16-colour palette TIFF copied into the macOS DMG by packa sha256 = "f46881724a6621f3686a612a79dbdce4f7dbe9e2025610e44c9a094341334c2c" [[fetched]]-file = "text-detection.rten"-url = "https://ocrs-models.s3-accelerate.amazonaws.com/text-detection.rten"+file = "text-detection.onnx"+url = "https://ocrs-models.s3-accelerate.amazonaws.com/text-detection.onnx" title = "Ocrs text detection model" author = "Robert Knight (ocrs-models; trained on HierText, CC-BY-SA-4.0)"-source = "https://github.com/robertknight/ocrs-models (the models ocrs downloads; model card: https://huggingface.co/robertknight/ocrs, cc-by-sa-4.0)"+source = "https://github.com/robertknight/ocrs/blob/0c826441362a701c55560fefc17bf356b6d1037e/ocrs/examples/download-models.sh (author-published ONNX models; model card: https://huggingface.co/robertknight/ocrs/blob/df0edd170279ab971b53e094c627255a87e1a503/README.md, cc-by-sa-4.0)" licence = "CC-BY-SA-4.0" licence_url = "https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt" licence_sha256 = "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5" kind = "model" usage = "Scan & OCR: finds words on page images (cargo xtask models)"-sha256 = "f15cfb56bd02c4bf478a20343986504a1f01e1665c2b3a0ad66340f054b1b5ca"+sha256 = "a917b23dbd9524b465df7e922641b3ff2981623df4ded5a0234004ef2fee7cfe" [[fetched]]-file = "text-recognition.rten"-url = "https://ocrs-models.s3-accelerate.amazonaws.com/text-recognition.rten"+file = "text-recognition.onnx"+url = "https://ocrs-models.s3-accelerate.amazonaws.com/text-recognition.onnx" title = "Ocrs text recognition model" author = "Robert Knight (ocrs-models; trained on HierText, CC-BY-SA-4.0)"-source = "https://github.com/robertknight/ocrs-models (the models ocrs downloads; model card: https://huggingface.co/robertknight/ocrs, cc-by-sa-4.0)"+source = "https://github.com/robertknight/ocrs/blob/0c826441362a701c55560fefc17bf356b6d1037e/ocrs/examples/download-models.sh (author-published ONNX models; model card: https://huggingface.co/robertknight/ocrs/blob/df0edd170279ab971b53e094c627255a87e1a503/README.md, cc-by-sa-4.0)" licence = "CC-BY-SA-4.0" licence_url = "https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt" licence_sha256 = "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5" kind = "model" usage = "Scan & OCR: reads the words it finds (cargo xtask models)"-sha256 = "e484866d4cce403175bd8d00b128feb08ab42e208de30e42cd9889d8f1735a6e"+sha256 = "86c145c2edb96c8caed5b1ebb8f44d706408922211451c309c625157dd6061c5" [[build_input]] name = "craft-fonts"@@ -1174,7 +1174,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=82a24b006eefa036b43c09 [[package]] name = "craft-keymap" version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=edc41f68fa24c46651c3b5117d10f0ead75ec9cb#edc41f68fa24c46651c3b5117d10f0ead75ec9cb"+source = "git+https://github.com/storytold/craft-libs?rev=acab34c0d8d84363ea3d05885f1a15601c233a19#acab34c0d8d84363ea3d05885f1a15601c233a19" dependencies = [ "egui", "serde",@@ -1184,7 +1184,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=edc41f68fa24c46651c3b5117d10f0ead75ec9cb#edc41f68fa24c46651c3b5117d10f0ead75ec9cb"+source = "git+https://github.com/storytold/craft-libs?rev=acab34c0d8d84363ea3d05885f1a15601c233a19#acab34c0d8d84363ea3d05885f1a15601c233a19" dependencies = [ "craft-keymap", "craft-quit",@@ -1210,7 +1210,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=edc41f68fa24c46651c3b5117d10f0ead75ec9cb#edc41f68fa24c46651c3b5117d10f0ead75ec9cb"+source = "git+https://github.com/storytold/craft-libs?rev=acab34c0d8d84363ea3d05885f1a15601c233a19#acab34c0d8d84363ea3d05885f1a15601c233a19" dependencies = [ "dispatch2", "egui",@@ -1221,7 +1221,7 @@ dependencies = [ [[package]] name = "craft-ui" version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=edc41f68fa24c46651c3b5117d10f0ead75ec9cb#edc41f68fa24c46651c3b5117d10f0ead75ec9cb"+source = "git+https://github.com/storytold/craft-libs?rev=acab34c0d8d84363ea3d05885f1a15601c233a19#acab34c0d8d84363ea3d05885f1a15601c233a19" dependencies = [ "egui", "log",@@ -4340,6 +4340,7 @@ dependencies = [ "ocrs", "pdfcraft-fonts", "rten",+ "tempfile", "thiserror 2.0.21", ] @@ -5473,6 +5474,7 @@ dependencies = [ "rten-base", "rten-gemm", "rten-model-file",+ "rten-onnx", "rten-parallel", "rten-shape-inference", "rten-simd",@@ -5522,6 +5524,12 @@ dependencies = [ "rten-base", ] +[[package]]+name = "rten-onnx"+version = "0.26.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "96944374568990b8d1bbc5bae5957585866f9dd8256130460405730948bfd42e"+ [[package]] name = "rten-parallel" version = "0.26.0"@@ -13,12 +13,12 @@ repository = "https://github.com/storytold/pdfcraft" [workspace.dependencies] # Shared frontend components; engines remain independent of egui.-craft-ui = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "edc41f68fa24c46651c3b5117d10f0ead75ec9cb", features = ["serde"] }+craft-ui = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "acab34c0d8d84363ea3d05885f1a15601c233a19", features = ["serde"] } # Quit the macOS way (#1136): ⌘Q asks about unsaved changes, and closing quits through `terminate:`.-craft-quit = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "edc41f68fa24c46651c3b5117d10f0ead75ec9cb" }+craft-quit = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "acab34c0d8d84363ea3d05885f1a15601c233a19" } # One menu definition for the native macOS menu bar and the in-window bar elsewhere.-craft-menu = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "edc41f68fa24c46651c3b5117d10f0ead75ec9cb" }-craft-keymap = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "edc41f68fa24c46651c3b5117d10f0ead75ec9cb", default-features = false }+craft-menu = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "acab34c0d8d84363ea3d05885f1a15601c233a19" }+craft-keymap = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "acab34c0d8d84363ea3d05885f1a15601c233a19", default-features = false } # Shared system spooler; document composition remains in pdfcraft-print. craft-print = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "42e30cd5b3f4b114270dd053fccbc33bedc47f68" } # Whether a path stored in a document may be opened (GoToR link targets).@@ -2,6 +2,8 @@ **Stage: alpha** · next: beta, ~25% (ready for real work 50% → 75%) and ~400–700 h away +> **Last reviewed:** 2026-10-27 | **Last updated:** 2026-10-27 | **Change:** minor (M10: vector-print appearance transforms retain small coefficients; estimates unchanged)+> **Last reviewed:** 2026-10-27 | **Last updated:** 2026-10-27 | **Change:** minor (M10: OCR model downloads use verified ONNX pairs with legacy discovery fallback; estimates unchanged) > **Last reviewed:** 2026-10-25 | **Last updated:** 2026-10-25 | **Change:** minor (M14 localization current state: Arabic logical catalog, explicit RTL label direction and mirrored stock chrome; native/browser RTL workflows unqualified. Native release Hans face via LXGW WenKai Lite; estimates unchanged) > **Last reviewed:** 2026-10-23 · **Last updated:** 2026-10-23 · **Change:** minor (M7, #2636 partial: pasting added text boxes and images in the engine and through `content_copy`; estimates unchanged) > **Last reviewed:** 2026-10-23 · **Last updated:** 2026-10-23 · **Change:** minor (M11: image optimization accounts for page-local UserUnit; estimates unchanged)@@ -199,6 +201,13 @@ Ranked; detail and the full milestone table in [docs/roadmap.md](docs/roadmap.md ## Progress log +- **2026-10-27 (M10, #5029):** Vector printing retains the orientation and upper-left anchor of existing NoRotate annotation appearances on rotated source pages.+ Crop origins, UserUnit and later sheet transforms remain effective; estimates unchanged.++- **2026-10-27 (M10, annotation print precision):** Vector printing preserves small placement coefficients for existing form, comment and stamp appearances with large bounding boxes or matrices.+ Synthetic render and save/reopen regressions cover the change; estimates unchanged.++- **2026-10-27 (M10, OCR models):** Model staging downloads and verifies the ONNX pair after the upstream RTEN URL brownout; runtime discovery prefers complete ONNX pairs per directory, retains complete RTEN fallback and preserves directory precedence. - **2026-10-24 (M10, #4158 partial):** Word, HTML, RTF and PowerPoint export keep a block that continues another on its line (an italic case name, a link, a superscript) as a run in its own style inside that paragraph, with the source's word space, instead of a paragraph of its own. Style changes that wrap onto the next line still split paragraphs (the reading blocks keep style boundaries). Estimates unchanged. - **2026-10-24 (M3, window move on Wayland, #3970 follow-up):** After a move or resize by PdfCraft's own title bar or edges, the button release given back to egui goes before the pointer leaving the window, so hover no longer sticks at the old place until the pointer moves. Found by CodeRabbit in review of #3970; a unit test covers it. Estimates unchanged. - **2026-10-24 (M14, #4253):** The annotation quick bar remembers Keep tool selected across restarts, including unpinning. Old and malformed settings keep safe defaults; the opt-in UI control channel reads and changes the same preference. Estimates unchanged.@@ -676,12 +685,17 @@ Newest first: the date, what moved, and the new overall estimate. ## Revision history +**2026-10-27 · minor:** M10: vector printing retains small appearance placement coefficients.+Synthetic rendering and save/reopen regressions cover the change.+Estimates unchanged.+ **2026-10-25 · minor:** M14 localization current state: Arabic catalogs stay logical, Arabic/Kurdish labels take an explicit RTL direction, and stock chrome mirrors; native/browser RTL input, IME and complex workflows remain unqualified. Native Simplified Chinese uses LXGW WenKai Lite; the web build has no Hans face. Estimates unchanged. **2026-10-15 · minor:** M14/#2383 candidate: GPU device requests clamp unsupported limits while retaining the adapter texture extent. Synthetic V3D/downlevel regressions and Windows GPU-required tests pass; Raspberry Pi hardware remains unverified. Estimates unchanged. | Date | Change | Summary | |---|---|---|+| 2026-10-27 | minor | M10: OCR stages SHA-256-verified ONNX models after the upstream RTEN URL brownout; discovery prefers a complete ONNX pair per directory, falls back to a complete RTEN pair, and never mixes formats or directories; language/web limits and estimates unchanged. | | 2026-10-23 | minor | M8, #3205 follow-up: phone-pattern redaction includes the +39 country code on labelled Italian geographic numbers with a slash; dates, protocol identifiers and whole-run guards remain. Estimates unchanged. | | 2026-10-23 | minor | M11: image downsampling measures physical resolution after page-local UserUnit scaling, including shared nested forms; synthetic measurement and optimization regressions. Estimates unchanged. | | 2026-10-23 | minor | M10: Word table cells use the grid columns they span, including cells after a merged cell; synthetic export regression and CLI reproduction. Estimates unchanged. |@@ -13,5 +13,8 @@ workspace = true [dependencies] pdfcraft-fonts = { workspace = true } ocrs = { version = "0.13.1", default-features = false, features = ["rten"] }-rten = { version = "0.26.0", default-features = false, features = ["rten_format"] }+rten = { version = "0.26.0", default-features = false, features = ["onnx_format", "rten_format"] } thiserror.workspace = true++[dev-dependencies]+tempfile = "3.27"@@ -15,8 +15,8 @@ use std::path::{Path, PathBuf}; pub use pdfcraft_fonts::helvetica_width; /// The model files, as named in ATTRIBUTION.toml.-pub const DETECTION_MODEL: &str = "text-detection.rten";-pub const RECOGNITION_MODEL: &str = "text-recognition.rten";+pub const DETECTION_MODEL: &str = "text-detection.onnx";+pub const RECOGNITION_MODEL: &str = "text-recognition.onnx"; /// The recognition model's alphabet, as it was trained (ocrs-models' `DEFAULT_ALPHABET`): its /// output classes follow this order. The ocrs crate's own copy has an `E` where the training had@@ -48,10 +48,13 @@ pub struct Models { } impl Models {- /// The models in `dir`, if both files are there.+ /// A complete model pair in `dir`, preferring current ONNX files over legacy RTEN files.+ /// An incomplete update never mixes formats or hides an intact legacy pair. pub fn in_dir(dir: &Path) -> Option<Models> {- let m = Models { detection: dir.join(DETECTION_MODEL), recognition: dir.join(RECOGNITION_MODEL) };- (m.detection.is_file() && m.recognition.is_file()).then_some(m)+ [(DETECTION_MODEL, RECOGNITION_MODEL), ("text-detection.rten", "text-recognition.rten")].into_iter().find_map(|(detection, recognition)| {+ let m = Models { detection: dir.join(detection), recognition: dir.join(recognition) };+ (m.detection.is_file() && m.recognition.is_file()).then_some(m)+ }) } /// Look for the models: `$PDFCRAFT_MODELS`, then where the release packages install them@@ -321,6 +324,63 @@ mod tests { assert_eq!(w.up, [-10.0, 0.0]); } + /// The current ONNX pair wins when an installation also retains both legacy models.+ #[test]+ fn model_discovery_prefers_the_complete_onnx_pair() {+ let dir = tempfile::tempdir().unwrap();+ for file in ["text-detection.onnx", "text-recognition.onnx"] {+ std::fs::write(dir.path().join(file), b"model").unwrap();+ }+ let expected = Some(Models { detection: dir.path().join("text-detection.onnx"), recognition: dir.path().join("text-recognition.onnx") });+ assert_eq!(Models::in_dir(dir.path()), expected, "a complete ONNX pair is sufficient");+ for file in ["text-detection.rten", "text-recognition.rten"] {+ std::fs::write(dir.path().join(file), b"model").unwrap();+ }+ assert_eq!(Models::in_dir(dir.path()), expected, "the complete ONNX pair takes precedence over legacy models");+ }++ /// An interrupted ONNX update still permits an intact legacy pair in the same directory.+ #[test]+ fn model_discovery_falls_back_to_legacy_when_the_onnx_pair_is_incomplete() {+ for current in ["text-detection.onnx", "text-recognition.onnx"] {+ let dir = tempfile::tempdir().unwrap();+ for file in [current, "text-detection.rten", "text-recognition.rten"] {+ std::fs::write(dir.path().join(file), b"model").unwrap();+ }+ assert_eq!(+ Models::in_dir(dir.path()),+ Some(Models { detection: dir.path().join("text-detection.rten"), recognition: dir.path().join("text-recognition.rten") }),+ "{current} alone must not hide a complete legacy pair"+ );+ }+ }++ /// Detection and recognition must come from one complete format pair, never a mixed update.+ #[test]+ fn model_discovery_refuses_mixed_format_pairs() {+ for pair in [["text-detection.onnx", "text-recognition.rten"], ["text-detection.rten", "text-recognition.onnx"]] {+ let dir = tempfile::tempdir().unwrap();+ for file in pair {+ std::fs::write(dir.path().join(file), b"model").unwrap();+ }+ assert_eq!(Models::in_dir(dir.path()), None, "{pair:?} is not a complete model pair");+ }+ }++ /// Existing source builds and PDFCRAFT_MODELS overrides retain their complete RTEN pair.+ #[test]+ fn model_discovery_keeps_legacy_only_installations() {+ let dir = tempfile::tempdir().unwrap();+ assert_eq!(Models::in_dir(dir.path()), None);+ std::fs::write(dir.path().join("text-detection.rten"), b"model").unwrap();+ assert_eq!(Models::in_dir(dir.path()), None, "one legacy model is incomplete");+ std::fs::write(dir.path().join("text-recognition.rten"), b"model").unwrap();+ assert_eq!(+ Models::in_dir(dir.path()),+ Some(Models { detection: dir.path().join("text-detection.rten"), recognition: dir.path().join("text-recognition.rten") })+ );+ }+ /// #103: every release package's layout puts the models where the installed app looks. /// Mirrors packaging/{windows/package.ps1,macos/package.sh,linux/package.sh,freebsd/package.sh}. #[test]@@ -36,6 +36,10 @@ Each source page becomes a Form XObject (its content wrapped in q/Q, plus the pr annotations); sheets place them with a clip. The result is a fresh, unencrypted, garbage-collected file (callers check the print permission). Annotation appearances receive unused XObject names, preserving existing page resources even when they use the same naming prefix.+Appearance placement keeps the full PDF number precision, including small coefficients needed by large appearance bounding boxes or matrices.+Existing printable NoRotate appearances keep their orientation and upper-left rectangle anchor when the source page is rotated.+Crop origins, UserUnit, sheet scaling, and later imposition rotations still apply; NoZoom does not cancel printing scale.+Missing or unusable appearance streams still cannot be printed. The GUI Print dialog remembers its last selected paper size across application sessions, including when Print is cancelled. The preference stores a canonical name such as `A4`;@@ -3,7 +3,7 @@ use super::settings::{Content, Settings}; use super::sheets::{Sheet, layout}; use super::*; -// Model-derived transforms and clipping bounds need their full PDF decimal precision.+// Transforms and clipping bounds need their full PDF decimal precision. fn geometry_number(value: f64) -> String { let mut bytes = Vec::new(); pdfcraft_cos::serialize(&Object::Real(value), &mut bytes);@@ -145,6 +145,20 @@ pub(crate) fn appearance_matrix(doc: &Document, form: &Dict, rect: [f64; 4]) -> Some(a) } +/// ISO 32000-1 section 12.5.3: counterrotate the fitted appearance about Rect's upper-left+/// corner in default user space. Crop, UserUnit and sheet transforms remain outside it.+fn no_rotate_placement(placement: Matrix, rect: [f64; 4], rotation: i64) -> Option<Matrix> {+ let [x, _, _, y] = rect;+ let counterrotation = match rotation {+ 90 => Matrix([0.0, 1.0, -1.0, 0.0, x + y, y - x]),+ 180 => Matrix([-1.0, 0.0, 0.0, -1.0, 2.0 * x, 2.0 * y]),+ 270 => Matrix([0.0, -1.0, 1.0, 0.0, x - y, y + x]),+ _ => Matrix::default(),+ };+ let placement = placement.then(&counterrotation);+ placement.0.iter().all(|value| value.is_finite()).then_some(placement)+}+ /// A Form XObject holding page `index` as it prints (user space; BBox = crop box). /// `pages` are the document's pages, listed once by the caller: listing them for each page /// printed would make printing quadratic in the page count.@@ -188,6 +202,13 @@ pub(crate) fn page_form( let Some(ap) = appearance(doc, &d) else { continue }; let form = doc.get(ap).as_dict().cloned().unwrap_or_default(); let Some(m) = appearance_matrix(doc, &form, rect) else { continue };+ let flags = d.get(b"F").and_then(|f| doc.resolve(f).as_int()).unwrap_or(0);+ let m = if flags & 16 != 0 {+ no_rotate_placement(m, rect, page.rotation(doc))+ .ok_or_else(|| PrintError::Invalid(format!("page {} has a non-finite NoRotate annotation placement", index.saturating_add(1))))?+ } else {+ m+ }; let ap = if !form.contains(b"Subtype") && let Object::Stream(stream) = &*doc.get(ap) {@@ -215,7 +236,18 @@ pub(crate) fn page_form( } }; let [a0, b0, c0, d0, e0, f0] = m.0;- body.extend(format!("q {} {} {} {} {} {} cm /{name} Do Q\n", n(a0), n(b0), n(c0), n(d0), n(e0), n(f0)).bytes());+ body.extend(+ format!(+ "q {} {} {} {} {} {} cm /{name} Do Q\n",+ geometry_number(a0),+ geometry_number(b0),+ geometry_number(c0),+ geometry_number(d0),+ geometry_number(e0),+ geometry_number(f0)+ )+ .bytes(),+ ); xobjects.set(name.into_bytes(), Object::Ref(ap)); } if !xobjects.is_empty() {@@ -56,6 +56,10 @@ fn render(bytes: Vec<u8>) -> RenderedPage { } fn render_page(bytes: Vec<u8>, index: usize) -> RenderedPage {+ render_page_at_size(bytes, index, (100, 100))+}++fn render_page_at_size(bytes: Vec<u8>, index: usize, size: (u32, u32)) -> RenderedPage { let page = PageRenderer::new(Arc::new(bytes), RenderConfig::default()).render(RenderRequest { page: index, kind: RequestKind::Pixels,@@ -66,7 +70,7 @@ fn render_page(bytes: Vec<u8>, index: usize) -> RenderedPage { }); assert_eq!(page.error, None); assert!(page.warnings.is_empty(), "{:?}", page.warnings);- assert_eq!((page.width, page.height), (100, 100));+ assert_eq!((page.width, page.height), size); page } @@ -204,6 +208,97 @@ fn missing_subtype_appearance_survives_vector_print() { assert_eq!(actual_bytes, expected_bytes); } +/// Appearance coordinates are independent of page units: a large BBox or Matrix can require+/// placement coefficients far below four decimal places even on an ordinary 100-point page.+#[test]+fn annotation_placement_preserves_small_transform_coefficients() {+ let (control, _, _) = widget_fixture(Some(Object::name("Form")), None);+ let control = render(saved(&control));+ for scale in [1.0, 4096.0, 75000.0] {+ for scaled_matrix in [false, true] {+ let (mut doc, ap, widget) = widget_fixture(Some(Object::name("Form")), None);+ let mut form = doc.get(ap).as_dict().unwrap().clone();+ let coordinates = if scaled_matrix { 1.0 } else { scale };+ form.set(b"BBox".to_vec(), numbers(&[0.0, 0.0, 20.0 * coordinates, 10.0 * coordinates]));+ if scaled_matrix {+ form.set(b"Matrix".to_vec(), numbers(&[scale, 0.0, 0.0, scale, 7.0, -13.0]));+ }+ doc.set(+ ap,+ Object::Stream(Stream::flate(form, format!("/Ink cs 0 1 0 scn 0 0 {} {} re f", 20.0 * coordinates, 10.0 * coordinates).as_bytes())),+ );+ for (subtype, content) in [+ ("Widget", Content::Document),+ ("Widget", Content::FormFieldsOnly),+ ("Square", Content::DocumentAndMarkups),+ ("Stamp", Content::DocumentAndStamps),+ ] {+ doc.update_dict(widget, |d| d.set(b"Subtype".to_vec(), Object::name(subtype))).unwrap();+ let before = saved(&doc);+ let source = render(before.clone());+ assert!(source.rgba == control.rgba, "equivalent source, scale={scale}, matrix={scaled_matrix}, {subtype}");+ let printed = impose(&doc, &print_settings(content)).unwrap();+ let reopened = Document::open(Arc::new(printed.clone())).unwrap();+ assert_eq!(pdfcraft_model::pages(&reopened).len(), 1);+ let printed = render(printed);+ assert_eq!(pixel(&printed, 30, 70), [0, 255, 0, 255], "scale={scale}, matrix={scaled_matrix}, {subtype}");+ if content != Content::FormFieldsOnly {+ assert!(printed.rgba == source.rgba, "scale={scale}, matrix={scaled_matrix}, {subtype}");+ }+ // Check the serialized placement too: sub-pixel translation rounding may be+ // invisible at 72 dpi while still moving the appearance's physical corners.+ let page = &pdfcraft_model::pages(&reopened)[0];+ let page_form = reopened.get(xobject(&reopened, &page.dict, b"P0"));+ let Object::Stream(page_form) = &*page_form else { panic!("page form") };+ let parsed = pdfcraft_content::parse(&page_form.decoded().unwrap());+ assert_eq!(parsed.skipped, 0);+ let matrices: Vec<_> = parsed.ops.iter().filter(|op| op.is("cm")).collect();+ assert_eq!(matrices.len(), 1);+ let placement = Matrix(matrices[0].nums::<6>().unwrap());+ let (x, y) = if scaled_matrix { (7.0, -13.0) } else { (0.0, 0.0) };+ for ((x, y), expected) in [(placement.apply(x, y), (10.0, 20.0)), (placement.apply(x + 20.0 * scale, y + 10.0 * scale), (50.0, 40.0))]+ {+ assert!((x - expected.0).abs() < 1e-10 && (y - expected.1).abs() < 1e-10, "corner ({x}, {y}) != {expected:?}");+ }+ assert_eq!(saved(&doc), before, "printing preserves the source");+ }+ }+ }+}++#[test]+fn unusable_appearance_geometry_keeps_page_artwork() {+ let (mut control, _, _) = widget_fixture(Some(Object::name("Form")), None);+ let page = pdfcraft_model::pages(&control)[0].obj;+ control+ .update_dict(page, |d| {+ d.remove(b"Annots");+ })+ .unwrap();+ let control = render(saved(&control));+ for (bbox, matrix) in [+ (None, None),+ (Some(numbers(&[0.0, 0.0, 20.0])), None),+ (Some(numbers(&[0.0, 0.0, 0.0, 10.0])), None),+ (Some(numbers(&[0.0, 0.0, 20.0, 0.0])), None),+ (Some(numbers(&[0.0, 0.0, 20.0, 10.0])), Some([0.0; 6])),+ ] {+ let (mut doc, ap, _) = widget_fixture(Some(Object::name("Form")), matrix);+ let mut form = doc.get(ap).as_dict().unwrap().clone();+ match bbox {+ Some(bbox) => form.set(b"BBox".to_vec(), bbox),+ None => {+ form.remove(b"BBox");+ }+ }+ doc.set(ap, Object::Stream(Stream::flate(form, b"/Ink cs 0 1 0 scn 0 0 20 10 re f")));+ let before = saved(&doc);+ let printed = render(impose(&doc, &print_settings(Content::Document)).unwrap());+ assert!(printed.rgba == control.rgba, "unusable appearance is omitted without losing page artwork");+ assert_eq!(saved(&doc), before);+ }+}+ #[test] fn promotion_preserves_streams_and_explicit_subtypes() { for subtype in [None, Some(Object::name("Form")), Some(Object::name("Image")), Some(Object::Null), Some(Object::Int(7))] {@@ -393,3 +488,236 @@ fn shared_promotions_span_pages_without_merging_distinct_sources() { } } }++const CORNER_COLORS: [[u8; 4]; 4] = [[255, 0, 0, 255], [0, 0, 255, 255], [0, 255, 0, 255], [255, 255, 0, 255]];++// Contributor-original, asymmetric 20 x 10 artwork: red/blue above green/yellow.+fn no_rotate_fixture(rotation: Object, origin: [f64; 2], subtype: &str, flags: i64) -> (Document, ObjRef, ObjRef) {+ let (mut doc, ap, annotation) = widget_fixture(Some(Object::name("Form")), None);+ let form = doc.get(ap).as_dict().unwrap().clone();+ doc.set(+ ap,+ Object::Stream(Stream::flate(form, b"0 1 0 rg 0 0 20 10 re f 1 0 0 rg 0 5 10 5 re f 0 0 1 rg 10 5 10 5 re f 1 1 0 rg 10 0 10 5 re f")),+ );+ let [x, y] = origin;+ doc.update_dict(annotation, |d| {+ d.set(b"Subtype".to_vec(), Object::name(subtype));+ d.set(b"F".to_vec(), Object::Int(flags));+ d.set(b"Rect".to_vec(), numbers(&[x + 40.0, y + 40.0, x + 60.0, y + 50.0]));+ })+ .unwrap();+ let page = pdfcraft_model::pages(&doc)[0].obj;+ doc.update_dict(page, |d| {+ d.set(b"MediaBox".to_vec(), numbers(&[x - 20.0, y - 20.0, x + 120.0, y + 120.0]));+ d.set(b"CropBox".to_vec(), numbers(&[x, y, x + 100.0, y + 100.0]));+ d.set(b"Rotate".to_vec(), rotation);+ d.remove(b"Contents");+ })+ .unwrap();+ (doc, ap, annotation)+}++fn assert_upright_corners(page: &RenderedPage, anchor: (usize, usize), scale: usize) {+ let (x, y) = anchor;+ for ((dx, dy), color) in [(5, 2), (15, 2), (5, 7), (15, 7)].into_iter().zip(CORNER_COLORS) {+ assert_eq!(pixel(page, x + dx * scale, y + dy * scale), color, "upright corner at {anchor:?}, scale={scale}");+ }+ for (px, py) in [(x - 2, y + 5 * scale), (x + 22 * scale, y + 5 * scale), (x + 10 * scale, y - 2), (x + 10 * scale, y + 12 * scale)] {+ assert_eq!(pixel(page, px, py), [255, 255, 255, 255], "outside the upright appearance at ({px},{py})");+ }+}++/// Literal device-space anchors and interior colors distinguish pivot, orientation, size and+/// the unflagged control, without reproducing the production counterrotation calculation.+#[test]+fn vector_print_preserves_no_rotate_appearance_anchors() {+ for (rotation, anchor, control) in [+ (0, (40, 50), [(45, 52), (55, 52), (45, 57), (55, 57)]),+ (90, (50, 40), [(47, 45), (47, 55), (42, 45), (42, 55)]),+ (180, (60, 50), [(55, 47), (45, 47), (55, 42), (45, 42)]),+ (270, (50, 60), [(52, 55), (52, 45), (57, 55), (57, 45)]),+ ] {+ for (subtype, reversed) in [("Widget", false), ("Square", false), ("Square", true), ("Stamp", false)] {+ for flags in [4, 20] {+ let (mut doc, ap, annotation) = no_rotate_fixture(Object::Int(rotation), [0.0, 0.0], subtype, flags);+ if reversed {+ doc.update_dict(annotation, |d| d.set(b"Rect".to_vec(), numbers(&[60.0, 50.0, 40.0, 40.0]))).unwrap();+ }+ let before = saved(&doc);+ let original = doc.get(ap);+ let settings = print_settings(Content::DocumentAndMarkups);+ let first = impose(&doc, &settings).unwrap();+ let reopened = Document::open(Arc::new(first.clone())).unwrap();+ for bytes in [first, impose(&reopened, &settings).unwrap()] {+ let page = render(bytes);+ if flags == 20 {+ assert_upright_corners(&page, anchor, 1);+ } else {+ for ((x, y), color) in control.into_iter().zip(CORNER_COLORS) {+ assert_eq!(pixel(&page, x, y), color, "control: rotation={rotation}, subtype={subtype}");+ }+ }+ }+ assert_eq!(doc.get(ap), original, "shared appearance bytes/dictionary stay unchanged");+ assert_eq!(saved(&doc), before, "rotation={rotation}, subtype={subtype}, flags={flags}");+ }+ }+ }+}++fn assert_translated_upright_source(actual: &RenderedPage, source: &RenderedPage, anchor: (i32, i32)) {+ let (dx, dy) = (anchor.0 - 40, anchor.1 - 50);+ for y in 0..100i32 {+ for x in 0..100i32 {+ let (sx, sy) = (x - dx, y - dy);+ let expected = if (0..100).contains(&sx) && (0..100).contains(&sy) { pixel(source, sx as usize, sy as usize) } else { &[255; 4] };+ let actual = pixel(actual, x as usize, y as usize);+ assert_eq!(actual, expected, "translated source at ({x},{y})");+ }+ }+}++#[test]+fn no_rotate_keeps_appearance_matrix_and_shifted_inherited_page_geometry() {+ for (rotation, inherited, origin, anchor) in+ [(450, true, [-20.0, 30.0], (50, 40)), (-180, false, [15.0, -25.0], (60, 50)), (-90, true, [-20.0, 30.0], (50, 60))]+ {+ for (matrix, shifted_bbox) in+ [([2.0, 0.0, 0.0, 3.0, 7.0, -11.0], true), ([1.0, 0.0, 1.0, 1.0, 7.0, -11.0], false), ([-1.0, 0.0, 0.0, 1.0, 27.0, -11.0], false)]+ {+ let (mut doc, ap, _) = no_rotate_fixture(Object::Int(rotation), origin, "Widget", 20);+ doc.update_dict(ap, |d| {+ d.set(b"Matrix".to_vec(), numbers(&matrix));+ if shifted_bbox {+ d.set(b"BBox".to_vec(), numbers(&[5.0, -4.0, 25.0, 6.0]));+ }+ })+ .unwrap();+ if shifted_bbox {+ let form = doc.get(ap).as_dict().unwrap().clone();+ doc.set(+ ap,+ Object::Stream(Stream::flate(+ form,+ b"q 1 0 0 1 5 -4 cm 0 1 0 rg 0 0 20 10 re f 1 0 0 rg 0 5 10 5 re f 0 0 1 rg 10 5 10 5 re f 1 1 0 rg 10 0 10 5 re f Q",+ )),+ );+ }+ let page = pdfcraft_model::pages(&doc)[0].obj;+ if inherited {+ let parent = doc.get(page).as_dict().unwrap().reference(b"Parent").unwrap();+ let rotation = Object::Ref(doc.add(Object::Int(rotation)));+ doc.update_dict(parent, |d| d.set(b"Rotate".to_vec(), rotation)).unwrap();+ doc.update_dict(page, |d| {+ d.remove(b"Rotate");+ })+ .unwrap();+ }+ let mut upright = doc.clone();+ upright.update_dict(page, |d| d.set(b"Rotate".to_vec(), Object::Int(0))).unwrap();+ let expected = render(saved(&upright));+ // Establish that the reference contains real asymmetric artwork, rather than+ // accepting two blank or uniformly colored renderings as equivalent.+ for color in CORNER_COLORS {+ assert!(expected.rgba.as_chunks::<4>().0.contains(&color));+ }+ let before = saved(&doc);+ let original = doc.get(ap);+ let settings = print_settings(Content::Document);+ let printed = impose(&doc, &settings).unwrap();+ let reopened = Document::open(Arc::new(printed.clone())).unwrap();+ assert_translated_upright_source(&render(printed), &expected, anchor);+ assert_translated_upright_source(&render(impose(&reopened, &settings).unwrap()), &expected, anchor);+ assert_eq!(doc.get(ap), original);+ assert_eq!(saved(&doc), before, "rotation={rotation}, inherited={inherited}, origin={origin:?}, matrix={matrix:?}");+ }+ }+}++#[test]+fn malformed_page_rotation_keeps_no_rotate_appearance_upright() {+ for rotation in [Object::Int(135), Object::Int(-45), Object::Real(90.5), Object::name("QuarterTurn")] {+ let (doc, _, _) = no_rotate_fixture(rotation.clone(), [-20.0, 30.0], "Widget", 20);+ assert_eq!(pdfcraft_model::pages(&doc)[0].rotation(&doc), 0);+ let before = saved(&doc);+ let printed = render(impose(&doc, &print_settings(Content::Document)).unwrap());+ assert_upright_corners(&printed, (40, 50), 1);+ assert_eq!(saved(&doc), before, "malformed Rotate={rotation:?}");+ }+}++#[test]+fn no_rotate_keeps_user_units_and_sheet_scaling() {+ let (mut doc, _, annotation) = no_rotate_fixture(Object::Int(90), [-20.0, 30.0], "Widget", 28);+ let page = pdfcraft_model::pages(&doc)[0].obj;+ doc.update_dict(page, |d| d.set(b"UserUnit".to_vec(), Object::Int(2))).unwrap();+ // Resolve the same flags as the existing print path; NoZoom does not cancel print scale.+ let flags = doc.add(Object::Int(28));+ doc.update_dict(annotation, |d| d.set(b"F".to_vec(), Object::Ref(flags))).unwrap();+ let before = saved(&doc);+ for (paper, layout, size, anchor, scale) in [+ ((200.0, 200.0), Layout::Size(SizeMode::Actual), (200, 200), (100, 80), 2),+ ((100.0, 100.0), Layout::Size(SizeMode::Custom(50.0)), (100, 100), (50, 40), 1),+ ] {+ let settings = Settings { paper, layout, ..print_settings(Content::Document) };+ let printed = render_page_at_size(impose(&doc, &settings).unwrap(), 0, size);+ assert_upright_corners(&printed, anchor, scale);+ }+ assert_eq!(saved(&doc), before);+}++#[test]+fn no_rotate_is_per_invocation_when_appearances_are_shared() {+ let (mut doc, ap, annotation) = no_rotate_fixture(Object::Int(90), [0.0, 0.0], "Widget", 20);+ let mut control = doc.get(annotation).as_dict().unwrap().clone();+ control.set(b"F".to_vec(), Object::Int(4));+ control.set(b"Rect".to_vec(), numbers(&[10.0, 10.0, 30.0, 20.0]));+ let control = doc.add(Object::Dict(control));+ let page = pdfcraft_model::pages(&doc)[0].obj;+ doc.update_dict(page, |d| d.set(b"Annots".to_vec(), Object::Array(vec![Object::Ref(annotation), Object::Ref(control)]))).unwrap();+ let before = saved(&doc);+ let original = doc.get(ap);+ let output = impose(&doc, &print_settings(Content::Document)).unwrap();+ let reopened = Document::open(Arc::new(output.clone())).unwrap();+ let rendered = render(output);+ assert_upright_corners(&rendered, (50, 40), 1);+ for ((x, y), color) in [(17, 15), (17, 25), (12, 15), (12, 25)].into_iter().zip(CORNER_COLORS) {+ assert_eq!(pixel(&rendered, x, y), color, "unflagged use of the shared appearance");+ }+ let sheet = &pdfcraft_model::pages(&reopened)[0];+ let form = reopened.get(xobject(&reopened, &sheet.dict, b"P0"));+ assert_eq!(xobject(&reopened, form.as_dict().unwrap(), b"PCPrA0"), xobject(&reopened, form.as_dict().unwrap(), b"PCPrA1"));+ assert_eq!(doc.get(ap), original);+ assert_eq!(saved(&doc), before);+}++#[test]+fn no_rotate_refuses_nonfinite_placement_and_still_skips_degenerate_appearances() {+ for (rotation, rect) in [(90, [1e308, 0.0, 1.7e308, 1e308]), (180, [1e308, 0.0, 1.7e308, 1e308]), (270, [-1e308, 0.0, -0.3e308, 1e308])] {+ let (mut doc, ap, annotation) = no_rotate_fixture(Object::Int(rotation), [0.0, 0.0], "Widget", 20);+ doc.update_dict(annotation, |d| d.set(b"Rect".to_vec(), numbers(&rect))).unwrap();+ let before = saved(&doc);+ let original = doc.get(ap);+ assert!(+ matches!(impose(&doc, &print_settings(Content::Document)), Err(PrintError::Invalid(_))),+ "rotation={rotation}: unrepresentable placement"+ );+ assert_eq!(doc.get(ap), original);+ assert_eq!(saved(&doc), before);+ let mut excluded = doc.clone();+ for flags in [16, 22] {+ excluded.update_dict(annotation, |d| d.set(b"F".to_vec(), Object::Int(flags))).unwrap();+ let printed = render(impose(&excluded, &print_settings(Content::Document)).unwrap());+ assert!(printed.rgba.as_chunks::<4>().0.iter().all(|pixel| *pixel == [255, 255, 255, 255]), "excluded malformed appearance");+ }+ }+ let (mut doc, ap, _) = no_rotate_fixture(Object::Int(90), [0.0, 0.0], "Widget", 20);+ doc.update_dict(ap, |d| d.set(b"BBox".to_vec(), numbers(&[0.0, 0.0, 0.0, 10.0]))).unwrap();+ let before = saved(&doc);+ let printed = render(impose(&doc, &print_settings(Content::Document)).unwrap());+ assert!(+ printed.rgba.as_chunks::<4>().0.iter().all(|pixel| *pixel == [255, 255, 255, 255]),+ "degenerate appearance keeps its existing omission behavior"+ );+ assert_eq!(saved(&doc), before);+}@@ -69,13 +69,20 @@ pinned in `release.yml` and builds with `CRAFT_FONTS_DIR` and `CRAFT_FONTS_REQUI embed its Japanese fonts and fail rather than ship without them (`AGENTS.md` §1.4). Bump the pin deliberately. -**OCR models:** every desktop package ships the Scan & OCR models (#103). The packaging scripts call-`stage_models` (`packaging/env.sh`; `package.ps1` on Windows), which runs `cargo xtask models` to-fetch every `kind = "model"` file in `ATTRIBUTION.toml` (verified by SHA-256) with its licence text-and an `ATTRIBUTION.txt`, straight into the package, so packaging needs the network. They go where-`pdfcraft_ocr::Models::dirs_beside_exe` looks: `models\` beside `pdfcraft.exe` (MSI, portable zip),-`PdfCraft.app/Contents/Resources/models` (macOS), and `share/pdfcraft/models` beside `bin/`-(deb, rpm, tar.gz, AppImage, Flatpak, FreeBSD). The web build doesn't include them yet.+**OCR models:** desktop packaging stages the Scan & OCR models (#103).+The packaging scripts call `stage_models` (`packaging/env.sh`; `package.ps1` on Windows), which runs `cargo xtask models` to fetch every `kind = "model"` file in `ATTRIBUTION.toml` and verify its SHA-256.+The current detection and recognition files are `text-detection.onnx` and `text-recognition.onnx`.+Each model ships with its licence text and the directory's `ATTRIBUTION.txt`, so packaging needs the network.+Upstream announced the legacy RTEN download URLs' brownout in [ocrs #282](https://github.com/robertknight/ocrs/issues/282) on 2026-10-27 and directs consumers to the ONNX models.++Runtime discovery prefers a complete ONNX detection/recognition pair within each directory, then a complete legacy `text-detection.rten` / `text-recognition.rten` pair.+An incomplete ONNX update can therefore use an intact RTEN pair in the same directory.+Discovery never combines model formats or files from different directories.+Directory precedence stays the same: `$PDFCRAFT_MODELS`, the release-package locations beside the executable, then the source tree's `assets/models/`.+The first directory with a complete supported pair wins, even if an earlier legacy pair precedes a later ONNX pair.++The release-package locations are `models\` beside `pdfcraft.exe` (MSI, portable zip), `PdfCraft.app/Contents/Resources/models` (macOS), and `share/pdfcraft/models` beside `bin/` (deb, rpm, tar.gz, AppImage, Flatpak, FreeBSD).+The web build does not include these models, and OCR remains limited to the Latin alphabet without accents. ### macOS @@ -1,5 +1,9 @@ # PdfCraft roadmap: milestones and what's next +> **Last reviewed:** 2026-10-27 | **Last updated:** 2026-10-27 | **Change:** minor (M10 #5029: vector printing preserves existing NoRotate appearance orientation and anchors; estimates unchanged)++> **Last reviewed:** 2026-10-27 | **Last updated:** 2026-10-27 | **Change:** minor (M10: vector-print appearance transforms retain small coefficients; estimates unchanged)+> **Last reviewed:** 2026-10-27 | **Last updated:** 2026-10-27 | **Change:** minor (M10: OCR model downloads use verified ONNX pairs with legacy discovery fallback; estimates unchanged) > **Last reviewed:** 2026-10-25 | **Last updated:** 2026-10-25 | **Change:** minor (M14 localization current state: Arabic logical catalog, explicit RTL label direction and mirrored stock chrome; native/browser RTL workflows unqualified. Native release Hans face via LXGW WenKai Lite; estimates unchanged) > **Last reviewed:** 2026-10-23 · **Last updated:** 2026-10-23 · **Change:** minor (M7, #2636 partial: pasting added text boxes and images in the engine and through `content_copy`; estimates unchanged) > **Last reviewed:** 2026-10-23 · **Last updated:** 2026-10-23 · **Change:** minor (M11: image optimization accounts for page-local UserUnit; estimates unchanged)@@ -193,7 +197,7 @@ total matches the parity estimate. | M7 | Content editing (text, images, header/footer, watermark) | 250–500 | 20% | 100–180 | Done: header & footer, watermarks, backgrounds, Bates; added text and images that stay editable (move, resize, format, rotate, flip, crop, replace); links (Link tool, Link Properties, create from URLs, remove all). Missing: editing existing text and images in place (the longest pole), image/PDF watermarks | | M8 | Security + redaction | 100–180 | 68% | 15–30 | Done: opening protected documents, permissions, Protect Using Password, Remove security; redaction (mark text/areas/pages, Search & Redact with patterns, apply removing glyphs, image pixels, vectors, XObject content, annotations and fields, verification, full rewrite on save); Remove hidden information and Sanitize.<br>Done since: redaction codes (U.S. FOIA and Privacy Act sets as overlay text, in Redaction properties and `redact_mark`). Redaction cleans indirect and form structure references, preserving surviving form tags. Redaction retires inherited resource dictionaries, so a parent `/Pages` can't keep a removed XObject reachable; unredacted pages are left untouched. Image redaction removes alternate images and unsupported masks only on affected images. Changed marked-content spans lose replacement descriptions; untouched spans keep theirs. Hidden-text cleanup retires unused named descriptions across inherited/shared page and form resources (64 focused tests and scoped Rust 1.96 Clippy/wasm checks pass; publication CI pending). The redaction audit counts a filled cover that hides half of any one word of a long line (#2662), applied or not. Phone-pattern redaction also matches labelled Italian geographic numbers with `+39` and a slash after the area code (#3205 follow-up); unlabelled international slash numbers remain unsupported. Missing: certificate security, custom redaction code sets and pattern locales, DCT re-encoding | | M9 | Signatures (PAdES, validation) | 160–280 | 60% | 40–70 | Done: new `sign` crate (DER, X.509, CMS, PKCS #12 on RustCrypto; aws-lc-rs for RSA private keys); PAdES B-B signing (visible, invisible, existing fields, certification with DocMDP); validation with trust store and changes-after-signing classification; self-signed digital IDs; Signatures panel, message bar, sign dialogs; agent tools. Checked with pdfsig and OpenSSL.<br>Done since: macOS Keychain and Windows Current User Personal store signing (software-backed CNG keys), certificate viewer, signed documents protected from rewrites, page validation overlays separate from original signature artwork (baked Not Verified captions remain; #79 open), snapshot tabs that reuse instead of multiplying. Missing: timestamps (B-T), LTV (DSS, OCSP, CRL), FieldMDP, smart cards, PKCS #11 |-| M10 | OCR, create, export, print | 200–350 | 33% | 120–215 | Done: create from blank/text/PNG/JPEG/TIFF (multi-page)/GIF/BMP; export PNG/JPEG/TIFF and text; Print (Acrobat's sizing, n-up, booklet, poster, comments & forms, preview, the CUPS and Windows spoolers, print-ready PDF).<br>Done since: embedded/72/custom DPI choices for image imports; export all images; OCR (searchable image for pages, ranges and multiple files); single-sided cut-and-stack imposition with cut marks, through Print and doc_print; architectural/ANSI/large ISO sheet presets, Match page at 100% and PDF-scale preview (#599 follow-up); Create PDF from multiple files (PDFs, images and text, edited as pages in the grid); OCR can also read pictures on pages that have text, without adding that text twice (#1028). Done since: Word invoice export uses borderless inferred tables, floating positioned text/artwork only where text overlaps an image or is rotated, and per-page sizes, covered by synthetic invoice automation regressions (#773); printing on the web through the browser's print dialog, sheets drawn by PdfCraft (gap 4). Lossless image export applies per-component Decode, including Indexed mapping (#1201 partial). Existing 16-bit precision and color-management limits remain. #3532 partial: vector printing retains existing appearances with absent Subtype through a print-owned Form copy; source artwork stays unchanged. #3120: Office export reads form XObjects 50 levels deep, as the renderer does, and up to 50 000 a page; pages past that are listed in `truncated_pages`. Word table cells use the grid columns they span, including cells after a merged cell. Done since: text in a table slot covered by another cell's span remains as paragraph text in Word, HTML, RTF and PowerPoint. Missing: OCR languages beyond Latin, editable-text OCR output, full Office layout fidelity/import. Done since: dotted-leader contents entries stay in separate complete paragraphs (#1757) #2156 candidate: last selected print paper persists across sessions; other print preferences unchanged. Image export applies soft-mask Decode opacity intervals before resizing, including indirect entries and inverted ranges. Vector printing gives annotation appearances unoccupied XObject names so existing page artwork survives. |+| M10 | OCR, create, export, print | 200–350 | 33% | 120–215 | Done: create from blank/text/PNG/JPEG/TIFF (multi-page)/GIF/BMP; export PNG/JPEG/TIFF and text; Print (Acrobat's sizing, n-up, booklet, poster, comments & forms, preview, the CUPS and Windows spoolers, print-ready PDF).<br>Done since: embedded/72/custom DPI choices for image imports; export all images; OCR (searchable image for pages, ranges and multiple files); single-sided cut-and-stack imposition with cut marks, through Print and doc_print; architectural/ANSI/large ISO sheet presets, Match page at 100% and PDF-scale preview (#599 follow-up); Create PDF from multiple files (PDFs, images and text, edited as pages in the grid); OCR can also read pictures on pages that have text, without adding that text twice (#1028). Model staging fetches SHA-256-verified ONNX detection/recognition files after the upstream RTEN URL brownout; runtime discovery prefers complete ONNX pairs per directory, then complete legacy RTEN pairs, without mixing formats or changing directory precedence. Done since: Word invoice export uses borderless inferred tables, floating positioned text/artwork only where text overlaps an image or is rotated, and per-page sizes, covered by synthetic invoice automation regressions (#773); printing on the web through the browser's print dialog, sheets drawn by PdfCraft (gap 4). Lossless image export applies per-component Decode, including Indexed mapping (#1201 partial). Existing 16-bit precision and color-management limits remain. #3532 partial: vector printing retains existing appearances with absent Subtype through a print-owned Form copy; source artwork stays unchanged. #3120: Office export reads form XObjects 50 levels deep, as the renderer does, and up to 50 000 a page; pages past that are listed in `truncated_pages`. Word table cells use the grid columns they span, including cells after a merged cell. Done since: text in a table slot covered by another cell's span remains as paragraph text in Word, HTML, RTF and PowerPoint. Missing: OCR languages beyond Latin, editable-text OCR output, full Office layout fidelity/import. Done since: dotted-leader contents entries stay in separate complete paragraphs (#1757) #2156 candidate: last selected print paper persists across sessions; other print preferences unchanged. Image export applies soft-mask Decode opacity intervals before resizing, including indirect entries and inverted ranges. Vector printing gives annotation appearances unoccupied XObject names so existing page artwork survives. Appearance placement retains small transform coefficients for large bounding boxes and matrices. Existing printable NoRotate appearances retain orientation and the upper-left rectangle anchor through source page rotation; later sheet transforms still apply (#5029). | | M11 | Optimize, preflight, PDF/A/X/UA, print production | 200–350 | 18% | 80–140 | Done: new `optimize` crate: Reduce File Size and the PDF Optimizer (images measured where drawn, bicubic downsampling, JPEG/ZIP recompression only when smaller, discard objects and user data, Flate clean-up, resource merging, object streams). Target-version compatibility is partial: newer content is not detected or converted. Content stream boundaries preserve comments, split operands and graphics state when image fragments merge. Image downsampling includes page-local `/UserUnit` scaling when measuring physical resolution. Done since: reject invalid image and soft-mask dimensions with checked sizing (#2178). Missing: fonts and transparency panels, space audit, preflight, PDF/A/X/UA | | M12 | Accessibility, compare, measure, search, XFA | 200–380 | 30% | 90–160 | Done: new `a11y` crate with the Accessibility Checker (all 32 rules, report, Fix/Skip/Explain, options dialog and results panel, agent tools). Locatable figure, annotation and form findings highlight their page bounds. Character encoding accepts Identity-H/V with Adobe CJK collections and predefined CJK CMaps independently (#3673); per-glyph validation and embedded-font extraction remain separate.<br>Done since: 2D distance, perimeter and area measurements with persistent viewport calibration, snapping, live information and CSV export; a bounded, text-only auto-tag proposal tool for one page. Marking a figure decorative rewrites only that stream (#1324). An XFA radio item whose value contains a space is written back unchanged (#1319). Done since: #2569: Growable multiline XFA text reflows after edits, with undo/redo, save/reopen and print coverage; oversized fields still become read-only page text. Structured-data synchronization warnings retain accepted whitespace without relayout from stale data. Done since: #2572: Every repeated page-master button resolves its own field to the shared XFA click script, including print buttons. Done since: #2570: Dynamic XFA rich-text fields carry exData/maxLength into AcroForm MaxLen for reported and enforced Unicode character limits, retained after save/reopen. Done since: #2589: Active XFA skips PDF-container fallback scripts while retaining requested messages and saved scripts; ordinary/static/unlaid-out documents and explicit console/field calls keep their existing behavior. Missing: writing proposed tags and parent tree, field autotag, visual Tags/Order/Content panels, Reading Order tool, compare, geospatial/3D measurement, search index, XFA<br>Reading colours: pending page backgrounds follow the configured colour (#2059). | | M13 | Automation (MCP, Action Wizard, CLI) + AI providers | 60–120 | 45% | 25–45 | Done: MCP resources (document info, text, page images); headless tool table (123 tools incl. signing, optimizing, initial view, links, stamps, data exchange, comment review, forms authoring and scripts, redaction, sanitize, print, add content), opt-in MCP server over stdio, CLI `run`/`tools` (closed stdout pipes exit cleanly), UI control channel with drag. Missing: Action Wizard, AI providers<br>Done since: CLI run and MCP reject missing, empty, repeated and option-valued --root arguments before any tool/script execution or MCP initialization. A single-hyphen directory name remains valid; synthetic CLI regressions preserve a would-be overwritten file. `text_find` also caps the per-page match ranges it materializes at the remaining result limit plus one continuation match. CLI robustness scans visit each directory once through overlapping roots and symlink aliases. |@@ -242,6 +246,10 @@ M2 (renderer), M7 (content editing), M10 (OCR and Office), M11 (Preflight and st ## Revision history +**2026-10-27 · minor:** M10: vector printing retains small appearance placement coefficients.+Synthetic rendering and save/reopen regressions cover the change.+Estimates unchanged.+ **2026-10-25 · minor:** M14 localization current state: Arabic catalogs stay logical, Arabic/Kurdish labels take an explicit RTL direction, and stock chrome mirrors; native/browser RTL input, IME and complex workflows remain unqualified. Native Simplified Chinese uses LXGW WenKai Lite; the web build has no Hans face. Estimates unchanged. **2026-10-23 · minor:** M11: image downsampling uses physical resolution after page-local `/UserUnit` scaling, including shared nested forms.@@ -254,6 +262,8 @@ Estimates unchanged. | Date | Change | Summary | |---|---|---|+| 2026-10-27 | minor | M10 #5029: vector printing preserves existing NoRotate appearance orientation and anchors; estimates unchanged. Missing appearances and NoZoom print behavior remain unchanged. |+| 2026-10-27 | minor | M10: OCR stages SHA-256-verified ONNX models after the upstream RTEN URL brownout; discovery prefers a complete ONNX pair per directory, falls back to a complete RTEN pair, and never mixes formats or directories; language/web limits and estimates unchanged. | | 2026-10-24 | minor | M3, #3970 follow-up: the button release given back after a window move or resize goes before the pointer leaving, so hover doesn't stick. Estimates unchanged. | | 2026-10-23 | minor | M8, #3205 follow-up: phone-pattern redaction includes the +39 country code on labelled Italian geographic numbers with a slash; dates, protocol identifiers and whole-run guards remain. Estimates unchanged. | | 2026-10-23 | minor | M10: Word table cells use the grid columns they span, including cells after a merged cell; synthetic export regression and CLI reproduction. Estimates unchanged. |@@ -288,13 +288,16 @@ $modelsDir = Read-Row 'SELECT `Directory_Parent`, `DefaultDir` FROM `Directory` Assert-Equal $modelsDir[0] 'INSTALLFOLDER' 'OCR models folder parent' # DefaultDir is `models`, or `SHORT|models` with a generated 8.3 name. if ($modelsDir[1] -notmatch '(^|\|)models$') { throw "OCR models folder name: '$($modelsDir[1])'" }-$modelFiles = 0+$modelFiles = @() $view = $Database.OpenView('SELECT `File`.`FileName` FROM `File`, `Component` WHERE `File`.`Component_` = `Component`.`Component` AND `Component`.`Directory_` = ''ModelsFolder''') try { [void] $view.Execute()- while ($record = $view.Fetch()) { if ($record.StringData(1) -match '\.rten$') { $modelFiles++ } }+ # FileName can contain a generated 8.3 name before the long name: SHORT|long.+ while ($record = $view.Fetch()) { $modelFiles += ($record.StringData(1) -split '\|')[-1] } } finally { [void] $view.Close() }-if ($modelFiles -lt 2) { throw "expected the OCR models (*.rten) in models\, found $modelFiles" }+foreach ($model in @('text-detection.onnx', 'text-recognition.onnx')) {+ Assert-Equal (@($modelFiles | Where-Object { $_ -ceq $model }).Count) 1 "OCR model $model in models\"+} $rm = Read-Row 'SELECT `Dialog` FROM `Dialog` WHERE `Dialog` = ''MsiRMFilesInUse''' 1 Assert-Equal $rm[0] 'MsiRMFilesInUse' 'Files-in-use dialog' [void] [Runtime.InteropServices.Marshal]::FinalReleaseComObject($Database)@@ -6544,8 +6544,8 @@ milestone = "M10" status = "shipped" commands = ["ocr.recognize"] tools = ["ocr_recognize", "ocr_status"]-evidence = ["crates/engine/src/tests.rs::recognize_text_makes_a_scanned_page_searchable", "crates/automation/tests/it/automation.rs::ocr_tools_make_a_scan_searchable", "crates/ui-egui/tests/it/ocr.rs::recognize_text_dialog_adds_searchable_text"]-notes = "ocrs engine (MIT/Apache) with CC-BY-SA models fetched by `cargo xtask models`; the desktop release packages ship them (#103; packaging/env.sh stage_models), the web build does not yet; runs on a worker thread with progress; one undoable step; pages with text are skipped unless asked (ocr.skip-renderable-text)."+evidence = ["crates/ocr/src/lib.rs::model_discovery_prefers_the_complete_onnx_pair", "crates/ocr/src/lib.rs::model_discovery_falls_back_to_legacy_when_the_onnx_pair_is_incomplete", "crates/ocr/src/lib.rs::model_discovery_refuses_mixed_format_pairs", "crates/ocr/src/lib.rs::model_discovery_keeps_legacy_only_installations", "crates/engine/src/tests.rs::recognize_text_makes_a_scanned_page_searchable", "crates/automation/tests/it/automation.rs::ocr_tools_make_a_scan_searchable", "crates/ui-egui/tests/it/ocr.rs::recognize_text_dialog_adds_searchable_text"]+notes = "ocrs engine (MIT/Apache) with CC-BY-SA ONNX models fetched and SHA-256 checked by `cargo xtask models`; within each search directory, a complete ONNX pair takes precedence over a complete legacy RTEN pair, incomplete and mixed-format pairs are not combined, and directory precedence is unchanged; the desktop release packages ship them (#103; packaging/env.sh stage_models), the web build does not yet; runs on a worker thread with progress; one undoable step; pages with text are skipped unless asked (ocr.skip-renderable-text)." [[feature]] id = "ocr.recognize-range"@@ -8156,8 +8156,8 @@ milestone = "M10" status = "shipped" commands = ["print.dialog"] tools = ["doc_print"]-evidence = ["crates/print/src/tests.rs::imposed_pdf_has_the_sheets_and_honours_comments_and_forms", "crates/print/src/tests/appearances.rs::annotation_appearances_do_not_replace_page_xobjects"]-notes = "Print flag honoured; appearance resource names preserve existing page XObjects and distinct annotations, including inherited resources"+evidence = ["crates/print/src/tests.rs::imposed_pdf_has_the_sheets_and_honours_comments_and_forms", "crates/print/src/tests/appearances.rs::annotation_appearances_do_not_replace_page_xobjects", "crates/print/src/tests/appearances.rs::annotation_placement_preserves_small_transform_coefficients", "crates/print/src/tests/appearances.rs::vector_print_preserves_no_rotate_appearance_anchors", "crates/print/src/tests/appearances.rs::no_rotate_keeps_user_units_and_sheet_scaling"]+notes = "Print flag honoured; appearance resource names preserve existing page XObjects and distinct annotations, including inherited resources. Placement retains small transform coefficients for large appearance bounding boxes and matrices. Existing NoRotate appearances retain orientation and the rectangle upper-left anchor through source page rotation; CropBox, UserUnit, sheet scaling and later imposition rotation still apply. NoZoom does not cancel print scale. Missing or unusable appearance streams remain outside this path." [[feature]] id = "print.print-with-comment-summary"