From b1109a363fbb1c0769eb9c6b63ef422d817d2c5f Mon Sep 17 00:00:00 2001 From: Braden Herman Date: Fri, 16 Oct 2026 10:36:09 -0500 Subject: [PATCH 1/6] M7: centre new added text on the click The Text tool put the clicked point at the top of the new box, so the first line appeared half a line below where the I-beam pointer was (7.2 pt at 12 pt). The first line is now centred on the click, and a click at the page's top edge keeps the box on the page. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/content_ui.rs | 7 +++++-- crates/ui-egui/tests/content.rs | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/content_ui.rs b/crates/ui-egui/src/content_ui.rs index 5f5ef32f77..f0156c3c10 100644 --- a/crates/ui-egui/src/content_ui.rs +++ b/crates/ui-egui/src/content_ui.rs @@ -372,8 +372,11 @@ pub(crate) fn page_input( let at = to_display(xf, info, page, p); let mut style = style.clone(); style.text.clear(); - let page_width = info.pages.get(page).map_or(f64::INFINITY, |p| p.width as f64); - let rect = [at[0], at[1] - style.size * 1.2, (at[0] + 200.0).min(page_width), at[1]]; + let (page_width, page_height) = info.pages.get(page).map_or((f64::INFINITY, f64::INFINITY), |p| (p.width as f64, p.height as f64)); + // The first line (1.2 em tall) is centred on the click, as the I-beam pointer is; its + // top was at the click, so the text appeared below where it was placed. + let top = (at[1] + style.size * 0.6).min(page_height); + let rect = [at[0], top - style.size * 1.2, (at[0] + 200.0).min(page_width), top]; style.rect = rect; cv.draft = Some(TextDraft { page, index: None, rect, text: String::new(), style, focus: true }); consumed = true; diff --git a/crates/ui-egui/tests/content.rs b/crates/ui-egui/tests/content.rs index dd2c032eff..eafac4a800 100644 --- a/crates/ui-egui/tests/content.rs +++ b/crates/ui-egui/tests/content.rs @@ -183,6 +183,39 @@ fn text_tool_deleting_a_draft_hides_the_old_added_glyphs_and_cancel_restores_the assert!(h.state().views[0].content.draft.is_none()); } +/// The text tool's pointer is an I-beam whose middle is the click: the new box's first line is +/// centred there, not hung below it. A click at the page's top edge keeps the box on the page. +#[test] +fn new_text_is_centred_on_the_click() { + let mut h = harness(); + assert!(h.state_mut().execute("edit.text")); + h.run_steps(2); + let (ph, size) = { + let s = h.state(); + (s.session.get(s.views[0].id).unwrap().info.pages[0].height as f64, s.text_style.size) + }; + // Display space (points, y up from the page's bottom) of a screen point on page 1. + let display = |h: &Harness<'static, PdfCraftApp>, p: Pos2| { + let r = h.state().views[0].page_screen_rect(0).expect("on screen"); + let k = f64::from(r.height()) / ph; + [f64::from(p.x - r.left()) / k, ph - f64::from(p.y - r.top()) / k] + }; + let p = at(&h, 40.0, 300.0); + click(&mut h, p); + let rect = h.state().views[0].content.draft.as_ref().expect("a box opened").rect; + let [x, y] = display(&h, p); + assert!((rect[0] - x).abs() < 0.5, "the box starts at the click ({} vs {x})", rect[0]); + let middle = rect[3] - size * 0.6; + assert!((middle - y).abs() < 0.5, "the first line's middle ({middle}) is at the click ({y})"); + // At the very top of the page the box stays on it. + h.get_by_label("Discard this text (Esc)").click(); + h.run_steps(3); + let p = at(&h, 40.0, 0.5); + click(&mut h, p); + let rect = h.state().views[0].content.draft.as_ref().expect("a box opened").rect; + assert!(rect[3] <= ph, "the box's top ({}) is on the page ({ph})", rect[3]); +} + #[test] fn clicking_elsewhere_keeps_the_text_and_starts_a_new_box() { // #74: a click elsewhere on the page threw away the text being typed and opened a new box. From 2af0f4045c1ac18b9aea3146c4d06f182feca4fb Mon Sep 17 00:00:00 2001 From: alehel Date: Wed, 18 Nov 2026 10:57:10 +0100 Subject: [PATCH 2/6] M7: clip PDF watermark sources to visible page bounds (#7687) --- Cargo.lock | 1 + ROADMAP.md | 2 + crates/automation/tests/it/automation.rs | 60 ++++++++++++++++++++++++ crates/organize/Cargo.toml | 1 + crates/organize/src/import.rs | 17 ++++--- crates/organize/src/tests.rs | 32 +++++++++++++ docs/roadmap.md | 5 +- parity/acrobat-features.toml | 4 +- 8 files changed, 110 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 20d3f9a16a..0245b31271 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4946,6 +4946,7 @@ dependencies = [ "hayro-syntax", "pdfcraft-content", "pdfcraft-cos", + "pdfcraft-model", "pdfcraft-oracle", "thiserror 2.0.21", ] diff --git a/ROADMAP.md b/ROADMAP.md index adb9fcbe10..4daf2c4d7a 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -265,6 +265,8 @@ Ranked; detail and the full milestone table in [docs/roadmap.md](docs/roadmap.md ## Progress log +- **2026-11-18 (M7, #7687):** PDF-page watermarks clip the source CropBox to MediaBox before sizing and rotating the imported form. Synthetic geometry and save/reopen render regressions cover oversized crops; estimates unchanged. + - **2026-11-16 (M5, #3741):** Ctrl+M opens Comments on Windows/Linux and repeated activation keeps it open. macOS leaves Command+M unbound for Minimize. Dispatch, menus, palette, shortcut help and control/headless metadata resolve the platform-specific registry binding. Mapping and real-input regressions are retained through the rebase; estimates unchanged. - **2026-11-03 (M3, #3669):** A drag across a table selects its rows, as Preview does, instead of reading order's detour down each column; a cell padded with spaces reads with the next cell of its row. Synthetic render and UI drag regressions; estimates unchanged. diff --git a/crates/automation/tests/it/automation.rs b/crates/automation/tests/it/automation.rs index 4674667382..1a8a15d4df 100644 --- a/crates/automation/tests/it/automation.rs +++ b/crates/automation/tests/it/automation.rs @@ -14787,3 +14787,63 @@ fn grouped_existing_thai_body_edits_saves_reopens_and_undo_restores_original_gly assert_eq!(page_text(&mut a, reopened), [new, old]); assert_eq!(ok(&mut a, "content_list", json!({"doc":reopened}))["count"], 0, "editing existing text must not create Add Text objects"); } + +/// #7687: an oversized source CropBox must not expose hidden artwork or change fit. +#[test] +fn pdf_watermark_uses_visible_source_crop_through_tools() { + use pdfcraft_cos::{Document, Object, SaveOptions, Stream, write_full}; + use std::sync::Arc; + let dir = workdir("watermark-visible-crop"); + let mut source = Document::open(Arc::new(fixture(2))).unwrap(); + for (index, crop_right) in [100, 140].into_iter().enumerate() { + let page = pdfcraft_model::page_at(&source, index).unwrap().obj; + let content = source.add(Object::Stream(Stream::flate( + Default::default(), + b"1 0 0 rg 20 30 80 120 re f 0 0 1 rg 20 30 20 50 re f 1 0 1 rg 100 30 40 120 re f", + ))); + source + .update_dict(page, |d| { + d.set(b"MediaBox".to_vec(), Object::Array(vec![20.into(), 30.into(), 100.into(), 150.into()])); + d.set(b"CropBox".to_vec(), Object::Array(vec![20.into(), 30.into(), crop_right.into(), 150.into()])); + d.set(b"Rotate".to_vec(), Object::Int(90)); + d.set(b"Contents".to_vec(), Object::Ref(content)); + }) + .unwrap(); + } + std::fs::write(dir.join("source.pdf"), write_full(&source, &SaveOptions::default()).unwrap()).unwrap(); + let mut target = Document::open(Arc::new(fixture(3))).unwrap(); + let first = pdfcraft_model::page_at(&target, 0).unwrap().obj; + target + .update_dict(first, |d| { + d.set(b"MediaBox".to_vec(), Object::Array(vec![0.into(), 0.into(), 215.into(), 280.into()])); + d.set(b"CropBox".to_vec(), Object::Array(vec![24.into(), 18.into(), 184.into(), 258.into()])); + }) + .unwrap(); + std::fs::write(dir.join("a.pdf"), write_full(&target, &SaveOptions::default()).unwrap()).unwrap(); + let mut a = auto(&dir); + for rotation in [0, 270] { + let mut rendered = Vec::new(); + for source_page in [1, 2] { + let doc = ok(&mut a, "doc_open", json!({"path": "a.pdf"}))["doc"].as_u64().unwrap(); + if rotation != 0 { + ok(&mut a, "page_rotate", json!({"doc": doc, "pages": [1], "degrees": rotation})); + } + let untouched = a.call("page_render", &json!({"doc": doc, "page": 2, "dpi": 72})).unwrap(); + ok( + &mut a, + "doc_watermark", + json!({"doc": doc, "pages": [1], "file": "source.pdf", "file_page": source_page, + "scale": 0.5, "rotation": 0, "opacity": 1, "offset_x": 22, "offset_y": 10}), + ); + let path = format!("marked-{rotation}-{source_page}.pdf"); + ok(&mut a, "doc_save", json!({"doc": doc, "path": path})); + let copy = ok(&mut a, "doc_open", json!({"path": path}))["doc"].as_u64().unwrap(); + assert_eq!(a.call("page_render", &json!({"doc": copy, "page": 2, "dpi": 72})).unwrap(), untouched); + let (w, _, rgba) = a.render_pixels(copy, 1, 1.0).unwrap(); + assert!(rgba.as_ref().as_chunks::<4>().0.iter().any(|p| p[0] > 240 && p[1] < 10 && p[2] < 10), "visible red artwork remains"); + assert!(!rgba.as_ref().as_chunks::<4>().0.iter().any(|p| p[0] > 240 && p[1] < 10 && p[2] > 240), "hidden magenta stays clipped"); + rendered.push((w, rgba.as_ref().to_vec())); + } + assert_eq!(rendered[0], rendered[1], "same displayed source gives identical saved watermark at target rotation {rotation}"); + } +} diff --git a/crates/organize/Cargo.toml b/crates/organize/Cargo.toml index 78507197a5..eec1d7def0 100644 --- a/crates/organize/Cargo.toml +++ b/crates/organize/Cargo.toml @@ -11,6 +11,7 @@ workspace = true [dependencies] pdfcraft-content = { workspace = true } pdfcraft-cos = { workspace = true } +pdfcraft-model = { workspace = true } thiserror = { workspace = true } [dev-dependencies] diff --git a/crates/organize/src/import.rs b/crates/organize/src/import.rs index f6991308af..931ec4f06a 100644 --- a/crates/organize/src/import.rs +++ b/crates/organize/src/import.rs @@ -571,9 +571,9 @@ pub fn import_value(dst: &mut Document, src: &Document, value: &Object) -> Resul } /// Page `page` of `src` as a form XObject in `dst` (its content and resources, no annotations), -/// for backgrounds and watermarks taken from a PDF. The form's `/BBox` is the page's crop box -/// and its `/Matrix` undoes the page rotation, so it draws upright as displayed. Returns the -/// form and its displayed size in points. +/// for backgrounds and watermarks taken from a PDF. The form's `/BBox` is the visible crop box +/// (clipped to the media box), and its `/Matrix` undoes the page rotation, so it draws upright +/// as displayed. Returns the form and its displayed size in points. pub fn page_as_form(dst: &mut Document, src: &Document, page: usize) -> Result<(ObjRef, (f64, f64)), OrganizeError> { use pdfcraft_cos::Stream; let all = walk(src)?; @@ -581,12 +581,11 @@ pub fn page_as_form(dst: &mut Document, src: &Document, page: usize) -> Result<( // the page's own. let (pr, d) = all.get(page).cloned().ok_or(OrganizeError::NoSuchPage(page))?; let own = src.get(pr).as_dict().cloned().unwrap_or_default(); - let rect = |k: &[u8]| -> Option<[f64; 4]> { - let a = src.resolve(d.get(k)?); - let v: Vec = a.as_array()?.iter().filter_map(|x| src.resolve(x).as_f64()).collect(); - (v.len() == 4).then(|| [v[0].min(v[2]), v[1].min(v[3]), v[0].max(v[2]), v[1].max(v[3])]) - }; - let bbox = rect(b"CropBox").or_else(|| rect(b"MediaBox")).unwrap_or([0.0, 0.0, 612.0, 792.0]); + // Use the viewer's effective bounds: an oversized CropBox must not reveal artwork + // outside MediaBox or change the watermark's aspect ratio and fit (#7687). + let source_page = pdfcraft_model::Page { obj: pr, dict: d }; + let bbox = source_page.crop(src); + let d = &source_page.dict; let (w, h) = (bbox[2] - bbox[0], bbox[3] - bbox[1]); let rotate = d.get(b"Rotate").and_then(|r| src.resolve(r).as_int()).unwrap_or(0).rem_euclid(360); // Content: the page's streams, decoded and joined. Of a stream damaged partway, the copy draws diff --git a/crates/organize/src/tests.rs b/crates/organize/src/tests.rs index 95c40566b9..6be5eaa9c2 100644 --- a/crates/organize/src/tests.rs +++ b/crates/organize/src/tests.rs @@ -4984,3 +4984,35 @@ fn combining_some_pages_brings_only_their_bookmarks_and_no_attachments() { assert_eq!(source_bookmarks(&all), [("Chapter one".to_string(), vec!["Section".to_string()])]); assert!(attachments(&all)); } + +/// #7687: a watermark source must clip and size the same visible area as the page. +#[test] +fn page_form_clips_crop_to_media_before_rotation() { + for (rotation, matrix, size) in [ + (0, [1., 0., 0., 1., -20., -30.], (80., 120.)), + (90, [0., -1., 1., 0., -30., 100.], (120., 80.)), + (180, [-1., 0., 0., -1., 100., 150.], (80., 120.)), + (270, [0., 1., -1., 0., 150., -20.], (120., 80.)), + ] { + for inherited in [false, true] { + let mut src = open(fixture()); + let page = pages(&src).unwrap()[0].obj; + let target = if inherited { src.get(page).as_dict().unwrap().reference(b"Parent").unwrap() } else { page }; + src.update_dict(target, |d| { + d.set(b"MediaBox".to_vec(), Object::Array(vec![20.into(), 30.into(), 100.into(), 150.into()])); + d.set(b"CropBox".to_vec(), Object::Array(vec![10.into(), 20.into(), 140.into(), 170.into()])); + d.set(b"Rotate".to_vec(), Object::Int(rotation)); + }) + .unwrap(); + let mut dst = Document::new_empty(); + let (form, actual_size) = page_as_form(&mut dst, &src, 0).unwrap(); + assert_eq!(actual_size, size); + let obj = dst.get(form); + let Object::Stream(stream) = &*obj else { panic!("form stream") }; + let numbers = + |key: &[u8]| -> Vec { stream.dict.get(key).unwrap().as_array().unwrap().iter().map(|x| x.as_f64().unwrap()).collect() }; + assert_eq!(numbers(b"BBox"), [20., 30., 100., 150.]); + assert_eq!(numbers(b"Matrix"), matrix); + } + } +} diff --git a/docs/roadmap.md b/docs/roadmap.md index fd12d39615..1ddff830de 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -5,6 +5,8 @@ - 2026-11-04 (M6, PR #5699 reset estimate): Charge expanded-name scans and field-name copy/comparison bytes; add three negative regressions and byte-exact refusal checks. # PdfCraft roadmap: milestones and what's next +> **Last reviewed:** 2026-11-18 · **Last updated:** 2026-11-18 · **Change:** patch (M7 #7687: PDF-page watermarks use the visible source bounds; estimates unchanged) + > **Last reviewed:** 2026-11-16 | **Last updated:** 2026-11-16 | **Change:** patch (M5 #3741: Ctrl+M opens Comments on Windows/Linux without toggling it closed; macOS leaves Command+M for Minimize; platform-specific shortcut surfaces and regressions retained; estimates unchanged) > **Last reviewed:** 2026-10-27 | **Last updated:** 2026-10-27 | **Change:** minor (M10: vector printing preserves annotation optional-content membership; estimates unchanged) @@ -278,7 +280,7 @@ total matches the parity estimate. | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions. Plain AcroForm XML imports retain all direct text around comments and processing instructions, including CDATA and character references.
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Multi-select choice fields write ascending `/I` option indices while preserving `/V` selection order; synthetic forms/engine regressions cover reverse selection and save/reopen. CSV export preserves carriage returns in names and values. | | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions. XML/XFDF exports preserve tabs and line breaks in names and comment metadata. Refreshed against upstream `99941daa` (2026-10-15).
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Multi-select choice fields write ascending `/I` option indices while preserving `/V` selection order; synthetic forms/engine regressions cover reverse selection and save/reopen. CSV export preserves carriage returns in names and values. | | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions. XML/XFDF exports preserve tabs and line breaks in names and comment metadata. Plain AcroForm XML imports retain all direct text around comments and processing instructions, including CDATA and character references. CSV export and spreadsheet merging quote tabs, and import distinguishes quoted tabs from TSV delimiters without changing field identities.
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Multi-select choice fields write ascending `/I` option indices while preserving `/V` selection order; synthetic forms/engine regressions cover reverse selection and save/reopen. CSV export preserves carriage returns in names and values. | -| 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). Done since: Edit text preserves Arabic/Hebrew `/ActualText` typing order, with font-independent regressions; single-glyph RTL ligature spans (including lam-alef) join their surrounding word. Done since (#1116): editable text regions grouped across compatible words and subset fonts, one rich-text editor over a background with the source text removed, embedded sfnt faces reused as editor faces, and visible (clipped) bounds for cropped-image selection and resize. Exclusive crops now resize across nested states and content streams, with shared clips fixed.
Done since: #594 ordinary paragraph drags preserve overlapping source text; UI/engine regressions, native save/reopen, independent-reader checks and full CI passed in the Linux test environment. #1200 candidate: local GoToR links open in desktop tabs and through root-confined automation; appearance-only edits preserve existing actions. Named destinations remain unapplied and `/NewWindow` is a tab hint. Done since: #3187: Added-image automation normalizes extreme signed rotation angles before combining them with the current orientation; integer bounds, history, pixels, save/reopen and MCP have regressions. Done since: #2592: Styled fallback fonts batch up to 240 glyphs per actual face and retain source styles. Budget refusal and distinct same-BaseFont descriptor weights have mutation-checked regressions; coverage and complex mixed runs remain limited. Done since: #5657 page-mark operations are atomic across selected pages, including shared/inherited resources and existing unsaved edits. Missing: editing existing text and images in place (the longest pole), image/PDF watermarks PR #2155 candidate: editor-owned crops preserve original clips through group moves; Arrange preserves added-item stream ownership and refuses unsafe scope/state/tag extraction; image handles and flips follow page orientation; general transforms and Unicode script toggles have headless tools. Clipboard, mixed-size formatting, Home pins and reloadable installed-font discovery have review regressions. Latest follow-up uses explicit image-paste events, refreshes the mixed-size display, and documents script normalization with Undo. Further review covers inherited Form text and mask chronology, scoped transform composition, affine resize/rotation pivots, paste/selection ownership, no-op scripts and page-menu permissions. Done since: #5835 a right-click on an image in crop mode keeps the crop and opens no menu, also over overlapping and rotated images. Thai editing (#2964, #3185): supported Form text is editable; legacy Thai retains source fonts and text settings. Cross-family replacement is explicit; unsafe groups and mixed contextual styles remain partial. Candidate #2750: Single-style Keep source fonts edits retain source glyphs and batch only missing glyphs in fallback fonts. Per-rewrite character eligibility and widths are cached; source and fallback edge spaces stay extractable. | +| 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). Done since: Edit text preserves Arabic/Hebrew `/ActualText` typing order, with font-independent regressions; single-glyph RTL ligature spans (including lam-alef) join their surrounding word. Done since (#1116): editable text regions grouped across compatible words and subset fonts, one rich-text editor over a background with the source text removed, embedded sfnt faces reused as editor faces, and visible (clipped) bounds for cropped-image selection and resize. Exclusive crops now resize across nested states and content streams, with shared clips fixed.
Done since: #594 ordinary paragraph drags preserve overlapping source text; UI/engine regressions, native save/reopen, independent-reader checks and full CI passed in the Linux test environment. #1200 candidate: local GoToR links open in desktop tabs and through root-confined automation; appearance-only edits preserve existing actions. Named destinations remain unapplied and `/NewWindow` is a tab hint. Done since: #3187: Added-image automation normalizes extreme signed rotation angles before combining them with the current orientation; integer bounds, history, pixels, save/reopen and MCP have regressions. Done since: #2592: Styled fallback fonts batch up to 240 glyphs per actual face and retain source styles. Budget refusal and distinct same-BaseFont descriptor weights have mutation-checked regressions; coverage and complex mixed runs remain limited. Done since: #5657 page-mark operations are atomic across selected pages, including shared/inherited resources and existing unsaved edits. Missing: editing existing text and images in place (the longest pole), image/PDF watermarks PR #2155 candidate: editor-owned crops preserve original clips through group moves; Arrange preserves added-item stream ownership and refuses unsafe scope/state/tag extraction; image handles and flips follow page orientation; general transforms and Unicode script toggles have headless tools. Clipboard, mixed-size formatting, Home pins and reloadable installed-font discovery have review regressions. Latest follow-up uses explicit image-paste events, refreshes the mixed-size display, and documents script normalization with Undo. Further review covers inherited Form text and mask chronology, scoped transform composition, affine resize/rotation pivots, paste/selection ownership, no-op scripts and page-menu permissions. Done since: #5835 a right-click on an image in crop mode keeps the crop and opens no menu, also over overlapping and rotated images. Thai editing (#2964, #3185): supported Form text is editable; legacy Thai retains source fonts and text settings. Cross-family replacement is explicit; unsafe groups and mixed contextual styles remain partial. Candidate #2750: Single-style Keep source fonts edits retain source glyphs and batch only missing glyphs in fallback fonts. Per-rewrite character eligibility and widths are cached; source and fallback edge spaces stay extractable. PDF-page watermark source bounds follow the visible CropBox/MediaBox intersection (#7687). | | 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). Done since: Edit text preserves Arabic/Hebrew `/ActualText` typing order, with font-independent regressions. Done since (#1116): editable text regions grouped across compatible words and subset fonts, one rich-text editor over a background with the source text removed, embedded sfnt faces reused as editor faces, and visible (clipped) bounds for cropped-image selection and resize. Exclusive crops now resize across nested states and content streams, with shared clips fixed.
Done since: #594 ordinary paragraph drags preserve overlapping source text; UI/engine regressions, native save/reopen, independent-reader checks and full CI passed in the Linux test environment. #1200 candidate: local GoToR links open in desktop tabs and through root-confined automation; appearance-only edits preserve existing actions. Named destinations remain unapplied and `/NewWindow` is a tab hint. #1316: replacing a line or paragraph keeps a neighbouring line whose glyph box overlaps when the baselines differ; a second copy on the same baseline is still replaced. Missing: editing existing text and images in place (the longest pole), image/PDF watermarks | | 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). #3212: Headers, Bates numbers, watermarks and added text stay visible after unfinished marked content, without revealing hidden content. Tracked editable text distinguishes repeated glyph spacing from word gaps, with synthetic paragraph/object regressions. Missing: editing existing text and images in place (the longest pole), watermark print/screen visibility and repeat | | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions.
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Existing simple field-font encodings and Differences are respected when generating appearances; an unencodable value uses a separate Helvetica appearance font without changing the source font. Synthetic reopen regressions cover punctuation, subset fallback and multiline text. Exact font metrics/layout and broader Unicode fallback remain incomplete. | @@ -375,6 +377,7 @@ Estimates unchanged. | Date | Change | Summary | |---|---|---| +| 2026-11-18 | patch | M7 #7687: PDF-page watermarks clip source crops to MediaBox before sizing and rotation; synthetic geometry and save/reopen render coverage. Estimates unchanged. | | 2026-11-16 | patch | M5 #3741: Ctrl+M opens Comments on Windows/Linux without toggling it closed; macOS leaves Command+M for Minimize; platform-specific shortcut surfaces and regressions retained; estimates unchanged. | | 2026-10-29 | minor | M10 #5029: existing Text appearances keep their implicit NoRotate orientation in vector printing even when the flag is clear. Print eligibility and source/AP objects remain unchanged; native viewing without the flag remains a separate gap. Estimates unchanged. | | 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. | diff --git a/parity/acrobat-features.toml b/parity/acrobat-features.toml index acf720af7d..044da9f7ea 100644 --- a/parity/acrobat-features.toml +++ b/parity/acrobat-features.toml @@ -2538,8 +2538,8 @@ milestone = "M7" status = "shipped" commands = ["edit.watermark"] tools = ["doc_watermark"] -evidence = ["crates/engine/src/tests.rs::backgrounds_and_watermarks_from_files"] -notes = "an image or a page of a PDF, scaled relative to the page, rotated, with opacity, behind or on top; the dialog's preview shows its frame and file name over the page, not the picture itself" +evidence = ["crates/engine/src/tests.rs::backgrounds_and_watermarks_from_files", "crates/automation/tests/it/automation.rs::pdf_watermark_uses_visible_source_crop_through_tools"] +notes = "an image or a page of a PDF (source CropBox clipped to MediaBox, #7687), scaled relative to the page, rotated, with opacity, behind or on top; the dialog's preview shows its frame and file name over the page, not the picture itself" [[feature]] id = "edit.watermark-update-remove" From a7fb2eb604c7795f2d42f728225c3d575d4dec86 Mon Sep 17 00:00:00 2001 From: alehel Date: Wed, 18 Nov 2026 13:20:03 +0100 Subject: [PATCH 3/6] M7: cover partial watermark crops and clarify shipped workflows (#7687) --- ROADMAP.md | 2 +- crates/organize/src/tests.rs | 67 +++++++++++++++++++++++------------- docs/roadmap.md | 10 +++--- 3 files changed, 50 insertions(+), 29 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 4daf2c4d7a..1f97360580 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -265,7 +265,7 @@ Ranked; detail and the full milestone table in [docs/roadmap.md](docs/roadmap.md ## Progress log -- **2026-11-18 (M7, #7687):** PDF-page watermarks clip the source CropBox to MediaBox before sizing and rotating the imported form. Synthetic geometry and save/reopen render regressions cover oversized crops; estimates unchanged. +- **2026-11-18 (M7, #7687):** PDF-page watermarks clip the source CropBox to MediaBox before sizing and rotating the imported form. Synthetic geometry and save/reopen render regressions cover oversized and partially overlapping crops; estimates unchanged. - **2026-11-16 (M5, #3741):** Ctrl+M opens Comments on Windows/Linux and repeated activation keeps it open. macOS leaves Command+M unbound for Minimize. Dispatch, menus, palette, shortcut help and control/headless metadata resolve the platform-specific registry binding. Mapping and real-input regressions are retained through the rebase; estimates unchanged. - **2026-11-03 (M3, #3669):** A drag across a table selects its rows, as Preview does, instead of reading order's detour down each column; a cell padded with spaces reads with the next cell of its row. Synthetic render and UI drag regressions; estimates unchanged. diff --git a/crates/organize/src/tests.rs b/crates/organize/src/tests.rs index 6be5eaa9c2..f822a81453 100644 --- a/crates/organize/src/tests.rs +++ b/crates/organize/src/tests.rs @@ -4988,31 +4988,50 @@ fn combining_some_pages_brings_only_their_bookmarks_and_no_attachments() { /// #7687: a watermark source must clip and size the same visible area as the page. #[test] fn page_form_clips_crop_to_media_before_rotation() { - for (rotation, matrix, size) in [ - (0, [1., 0., 0., 1., -20., -30.], (80., 120.)), - (90, [0., -1., 1., 0., -30., 100.], (120., 80.)), - (180, [-1., 0., 0., -1., 100., 150.], (80., 120.)), - (270, [0., 1., -1., 0., 150., -20.], (120., 80.)), + for (crop, bbox, rotations) in [ + ( + [10, 20, 140, 170], + [20., 30., 100., 150.], + [ + (0, [1., 0., 0., 1., -20., -30.], (80., 120.)), + (90, [0., -1., 1., 0., -30., 100.], (120., 80.)), + (180, [-1., 0., 0., -1., 100., 150.], (80., 120.)), + (270, [0., 1., -1., 0., 150., -20.], (120., 80.)), + ], + ), + // Neither input box equals the intersection: ignoring CropBox must fail too. + ( + [40, 10, 140, 110], + [40., 30., 100., 110.], + [ + (0, [1., 0., 0., 1., -40., -30.], (60., 80.)), + (90, [0., -1., 1., 0., -30., 100.], (80., 60.)), + (180, [-1., 0., 0., -1., 100., 110.], (60., 80.)), + (270, [0., 1., -1., 0., 110., -40.], (80., 60.)), + ], + ), ] { - for inherited in [false, true] { - let mut src = open(fixture()); - let page = pages(&src).unwrap()[0].obj; - let target = if inherited { src.get(page).as_dict().unwrap().reference(b"Parent").unwrap() } else { page }; - src.update_dict(target, |d| { - d.set(b"MediaBox".to_vec(), Object::Array(vec![20.into(), 30.into(), 100.into(), 150.into()])); - d.set(b"CropBox".to_vec(), Object::Array(vec![10.into(), 20.into(), 140.into(), 170.into()])); - d.set(b"Rotate".to_vec(), Object::Int(rotation)); - }) - .unwrap(); - let mut dst = Document::new_empty(); - let (form, actual_size) = page_as_form(&mut dst, &src, 0).unwrap(); - assert_eq!(actual_size, size); - let obj = dst.get(form); - let Object::Stream(stream) = &*obj else { panic!("form stream") }; - let numbers = - |key: &[u8]| -> Vec { stream.dict.get(key).unwrap().as_array().unwrap().iter().map(|x| x.as_f64().unwrap()).collect() }; - assert_eq!(numbers(b"BBox"), [20., 30., 100., 150.]); - assert_eq!(numbers(b"Matrix"), matrix); + for (rotation, matrix, size) in rotations { + for inherited in [false, true] { + let mut src = open(fixture()); + let page = pages(&src).unwrap()[0].obj; + let target = if inherited { src.get(page).as_dict().unwrap().reference(b"Parent").unwrap() } else { page }; + src.update_dict(target, |d| { + d.set(b"MediaBox".to_vec(), Object::Array(vec![20.into(), 30.into(), 100.into(), 150.into()])); + d.set(b"CropBox".to_vec(), Object::Array(crop.into_iter().map(Object::Int).collect())); + d.set(b"Rotate".to_vec(), Object::Int(rotation)); + }) + .unwrap(); + let mut dst = Document::new_empty(); + let (form, actual_size) = page_as_form(&mut dst, &src, 0).unwrap(); + assert_eq!(actual_size, size); + let obj = dst.get(form); + let Object::Stream(stream) = &*obj else { panic!("form stream") }; + let numbers = + |key: &[u8]| -> Vec { stream.dict.get(key).unwrap().as_array().unwrap().iter().map(|x| x.as_f64().unwrap()).collect() }; + assert_eq!(numbers(b"BBox"), bbox); + assert_eq!(numbers(b"Matrix"), matrix); + } } } } diff --git a/docs/roadmap.md b/docs/roadmap.md index 1ddff830de..a972125f2a 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -280,12 +280,12 @@ total matches the parity estimate. | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions. Plain AcroForm XML imports retain all direct text around comments and processing instructions, including CDATA and character references.
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Multi-select choice fields write ascending `/I` option indices while preserving `/V` selection order; synthetic forms/engine regressions cover reverse selection and save/reopen. CSV export preserves carriage returns in names and values. | | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions. XML/XFDF exports preserve tabs and line breaks in names and comment metadata. Refreshed against upstream `99941daa` (2026-10-15).
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Multi-select choice fields write ascending `/I` option indices while preserving `/V` selection order; synthetic forms/engine regressions cover reverse selection and save/reopen. CSV export preserves carriage returns in names and values. | | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions. XML/XFDF exports preserve tabs and line breaks in names and comment metadata. Plain AcroForm XML imports retain all direct text around comments and processing instructions, including CDATA and character references. CSV export and spreadsheet merging quote tabs, and import distinguishes quoted tabs from TSV delimiters without changing field identities.
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Multi-select choice fields write ascending `/I` option indices while preserving `/V` selection order; synthetic forms/engine regressions cover reverse selection and save/reopen. CSV export preserves carriage returns in names and values. | -| 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). Done since: Edit text preserves Arabic/Hebrew `/ActualText` typing order, with font-independent regressions; single-glyph RTL ligature spans (including lam-alef) join their surrounding word. Done since (#1116): editable text regions grouped across compatible words and subset fonts, one rich-text editor over a background with the source text removed, embedded sfnt faces reused as editor faces, and visible (clipped) bounds for cropped-image selection and resize. Exclusive crops now resize across nested states and content streams, with shared clips fixed.
Done since: #594 ordinary paragraph drags preserve overlapping source text; UI/engine regressions, native save/reopen, independent-reader checks and full CI passed in the Linux test environment. #1200 candidate: local GoToR links open in desktop tabs and through root-confined automation; appearance-only edits preserve existing actions. Named destinations remain unapplied and `/NewWindow` is a tab hint. Done since: #3187: Added-image automation normalizes extreme signed rotation angles before combining them with the current orientation; integer bounds, history, pixels, save/reopen and MCP have regressions. Done since: #2592: Styled fallback fonts batch up to 240 glyphs per actual face and retain source styles. Budget refusal and distinct same-BaseFont descriptor weights have mutation-checked regressions; coverage and complex mixed runs remain limited. Done since: #5657 page-mark operations are atomic across selected pages, including shared/inherited resources and existing unsaved edits. Missing: editing existing text and images in place (the longest pole), image/PDF watermarks PR #2155 candidate: editor-owned crops preserve original clips through group moves; Arrange preserves added-item stream ownership and refuses unsafe scope/state/tag extraction; image handles and flips follow page orientation; general transforms and Unicode script toggles have headless tools. Clipboard, mixed-size formatting, Home pins and reloadable installed-font discovery have review regressions. Latest follow-up uses explicit image-paste events, refreshes the mixed-size display, and documents script normalization with Undo. Further review covers inherited Form text and mask chronology, scoped transform composition, affine resize/rotation pivots, paste/selection ownership, no-op scripts and page-menu permissions. Done since: #5835 a right-click on an image in crop mode keeps the crop and opens no menu, also over overlapping and rotated images. Thai editing (#2964, #3185): supported Form text is editable; legacy Thai retains source fonts and text settings. Cross-family replacement is explicit; unsafe groups and mixed contextual styles remain partial. Candidate #2750: Single-style Keep source fonts edits retain source glyphs and batch only missing glyphs in fallback fonts. Per-rewrite character eligibility and widths are cached; source and fallback edge spaces stay extractable. PDF-page watermark source bounds follow the visible CropBox/MediaBox intersection (#7687). | -| 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). Done since: Edit text preserves Arabic/Hebrew `/ActualText` typing order, with font-independent regressions. Done since (#1116): editable text regions grouped across compatible words and subset fonts, one rich-text editor over a background with the source text removed, embedded sfnt faces reused as editor faces, and visible (clipped) bounds for cropped-image selection and resize. Exclusive crops now resize across nested states and content streams, with shared clips fixed.
Done since: #594 ordinary paragraph drags preserve overlapping source text; UI/engine regressions, native save/reopen, independent-reader checks and full CI passed in the Linux test environment. #1200 candidate: local GoToR links open in desktop tabs and through root-confined automation; appearance-only edits preserve existing actions. Named destinations remain unapplied and `/NewWindow` is a tab hint. #1316: replacing a line or paragraph keeps a neighbouring line whose glyph box overlaps when the baselines differ; a second copy on the same baseline is still replaced. Missing: editing existing text and images in place (the longest pole), image/PDF watermarks | -| 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). #3212: Headers, Bates numbers, watermarks and added text stay visible after unfinished marked content, without revealing hidden content. Tracked editable text distinguishes repeated glyph spacing from word gaps, with synthetic paragraph/object regressions. Missing: editing existing text and images in place (the longest pole), watermark print/screen visibility and repeat | +| M7 | Content editing (text, images, header/footer, watermark) | 250–500 | 20% | 100–180 | Done: header & footer, text/image/PDF-page 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). Done since: Edit text preserves Arabic/Hebrew `/ActualText` typing order, with font-independent regressions; single-glyph RTL ligature spans (including lam-alef) join their surrounding word. Done since (#1116): editable text regions grouped across compatible words and subset fonts, one rich-text editor over a background with the source text removed, embedded sfnt faces reused as editor faces, and visible (clipped) bounds for cropped-image selection and resize. Exclusive crops now resize across nested states and content streams, with shared clips fixed.
Done since: #594 ordinary paragraph drags preserve overlapping source text; UI/engine regressions, native save/reopen, independent-reader checks and full CI passed in the Linux test environment. #1200 candidate: local GoToR links open in desktop tabs and through root-confined automation; appearance-only edits preserve existing actions. Named destinations remain unapplied and `/NewWindow` is a tab hint. Done since: #3187: Added-image automation normalizes extreme signed rotation angles before combining them with the current orientation; integer bounds, history, pixels, save/reopen and MCP have regressions. Done since: #2592: Styled fallback fonts batch up to 240 glyphs per actual face and retain source styles. Budget refusal and distinct same-BaseFont descriptor weights have mutation-checked regressions; coverage and complex mixed runs remain limited. Done since: #5657 page-mark operations are atomic across selected pages, including shared/inherited resources and existing unsaved edits. Missing: editing existing text and images in place (the longest pole), watermark picture previews, edge-relative positioning, and print/screen-only visibility. PR #2155 candidate: editor-owned crops preserve original clips through group moves; Arrange preserves added-item stream ownership and refuses unsafe scope/state/tag extraction; image handles and flips follow page orientation; general transforms and Unicode script toggles have headless tools. Clipboard, mixed-size formatting, Home pins and reloadable installed-font discovery have review regressions. Latest follow-up uses explicit image-paste events, refreshes the mixed-size display, and documents script normalization with Undo. Further review covers inherited Form text and mask chronology, scoped transform composition, affine resize/rotation pivots, paste/selection ownership, no-op scripts and page-menu permissions. Done since: #5835 a right-click on an image in crop mode keeps the crop and opens no menu, also over overlapping and rotated images. Thai editing (#2964, #3185): supported Form text is editable; legacy Thai retains source fonts and text settings. Cross-family replacement is explicit; unsafe groups and mixed contextual styles remain partial. Candidate #2750: Single-style Keep source fonts edits retain source glyphs and batch only missing glyphs in fallback fonts. Per-rewrite character eligibility and widths are cached; source and fallback edge spaces stay extractable. PDF-page watermark source bounds follow the visible CropBox/MediaBox intersection (#7687). | +| M7 | Content editing (text, images, header/footer, watermark) | 250–500 | 20% | 100–180 | Done: header & footer, text/image/PDF-page 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). Done since: Edit text preserves Arabic/Hebrew `/ActualText` typing order, with font-independent regressions. Done since (#1116): editable text regions grouped across compatible words and subset fonts, one rich-text editor over a background with the source text removed, embedded sfnt faces reused as editor faces, and visible (clipped) bounds for cropped-image selection and resize. Exclusive crops now resize across nested states and content streams, with shared clips fixed.
Done since: #594 ordinary paragraph drags preserve overlapping source text; UI/engine regressions, native save/reopen, independent-reader checks and full CI passed in the Linux test environment. #1200 candidate: local GoToR links open in desktop tabs and through root-confined automation; appearance-only edits preserve existing actions. Named destinations remain unapplied and `/NewWindow` is a tab hint. #1316: replacing a line or paragraph keeps a neighbouring line whose glyph box overlaps when the baselines differ; a second copy on the same baseline is still replaced. Missing: editing existing text and images in place (the longest pole), watermark picture previews, edge-relative positioning, and print/screen-only visibility | +| M7 | Content editing (text, images, header/footer, watermark) | 250–500 | 20% | 100–180 | Done: header & footer, text/image/PDF-page 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). #3212: Headers, Bates numbers, watermarks and added text stay visible after unfinished marked content, without revealing hidden content. Tracked editable text distinguishes repeated glyph spacing from word gaps, with synthetic paragraph/object regressions. Missing: editing existing text and images in place (the longest pole), watermark print/screen visibility and repeat | | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions.
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Existing simple field-font encodings and Differences are respected when generating appearances; an unencodable value uses a separate Helvetica appearance font without changing the source font. Synthetic reopen regressions cover punctuation, subset fallback and multiline text. Exact font metrics/layout and broader Unicode fallback remain incomplete. | | M6 | Forms + JavaScript | 160–320 | 50% | 40–75 | Done: filling all field types with regenerated appearances; Prepare a form (every field type, multi-select/shared properties, move/resize/delete, Field Properties General/Appearance/Position/Options/Format/Validate/Calculate); Acrobat's AF format/keystroke/validate/calculate functions and simplified field notation run natively in Acrobat's event order; tab order; push-button actions; flatten; agent tools. Form data exchange (FDF, XFDF, XML, CSV, text) done; XFDF values retain text across XML comments and processing instructions.
Done since: JavaScript engine (boa, sandboxed) running custom keystroke/validate/calculate/format and button scripts, document JavaScripts, console. Missing: Actions tab, wider object model (annotations, layers, dialogs), XFA
Done since: Tab and Shift-Tab wrapping to the same field or another widget of that field refresh the newly opened editor from the accepted value before Save. Synthetic UI regressions cover both directions, same-frame Save, validation refusal and undo/redo. Renaming a field renames it in the calculations that read it (field lists, notation, literal `getField` names), in one undo step, and says how many changed. Prepare a form ▸ Calculation order, a page of its own: each calculated field's formula and value, what is wrong (fields that calculate too early, loops, fields missing from `/CO`) and Fix order, Up/Down, Alt+↑/↓ and drag, and on the page each field's step and arrows to and from the field in focus (`form_calculation_order` headlessly).
Done since (#4088): automatic AcroForm field scripts ignore Print with a console diagnostic; explicit button and console printing remain available. Integrated main f137a289 (0.16.1) on 2026-10-31; ShowPanel/SaveAs filtering, all three engine regressions, the headless regression, field effects and document-error provenance are retained. Windows x64 / Rust 1.95 validation: 761 engine/automation tests passed, zero failed and four existing ignored; formatting, scoped all-target Clippy with -D warnings, layers/assets/parity and the engine/automation WebAssembly check passed. A fresh CLI build and the 13-step synthetic form exercise passed; the inspected render shows Qty=4 and Total=8, and explicit button/console Print requests are retained. Main's 100 headless parity notices, five renderer WebAssembly warnings and three optional egui patch notices remain. Estimates unchanged. | -| 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 | +| M7 | Content editing (text, images, header/footer, watermark) | 250–500 | 20% | 100–180 | Done: header & footer, text/image/PDF-page 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), watermark picture previews, edge-relative positioning, and print/screen-only visibility | | 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.
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.
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).
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. Vector printing preserves each annotation's OCG/OCMD membership and shared-appearance independence (#5005). | @@ -346,6 +346,8 @@ M2 (renderer), M7 (content editing), M10 (OCR and Office), M11 (Preflight and st ## Revision history +**2026-11-18 · patch:** #7704 review: distinguish shipped file watermarks from picture-preview, edge-positioning and print/screen visibility limitations. Estimates unchanged. + **2026-10-31 · minor:** M3/#5452: native Home Recent context menus reuse tab reveal, retaining missing-file errors and leaving documents and history unchanged. Estimates unchanged. **2026-11-09 · patch:** M4 #4594: reconcile upstream license notices, roadmap entries and UI test modules without changing the Document Properties draft guard or dependency policy. Estimates unchanged. From 1285b2fd306d98016d32608cbf92523113752b0d Mon Sep 17 00:00:00 2001 From: alehel Date: Wed, 18 Nov 2026 13:29:15 +0100 Subject: [PATCH 4/6] M7: cover opposite partial watermark crop overlap (#7687) --- crates/organize/src/tests.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/organize/src/tests.rs b/crates/organize/src/tests.rs index f822a81453..6f0e6560ca 100644 --- a/crates/organize/src/tests.rs +++ b/crates/organize/src/tests.rs @@ -5010,6 +5010,17 @@ fn page_form_clips_crop_to_media_before_rotation() { (270, [0., 1., -1., 0., 110., -40.], (80., 60.)), ], ), + // The opposite overlap takes the bottom and right edges from CropBox. + ( + [10, 50, 80, 170], + [20., 50., 80., 150.], + [ + (0, [1., 0., 0., 1., -20., -50.], (60., 100.)), + (90, [0., -1., 1., 0., -50., 80.], (100., 60.)), + (180, [-1., 0., 0., -1., 80., 150.], (60., 100.)), + (270, [0., 1., -1., 0., 150., -20.], (100., 60.)), + ], + ), ] { for (rotation, matrix, size) in rotations { for inherited in [false, true] { From a1688846ff85aeb674ff62b83dfd9f8f8d6f30d6 Mon Sep 17 00:00:00 2001 From: alehel Date: Thu, 19 Nov 2026 06:44:21 +0100 Subject: [PATCH 5/6] Preserve zero-area PDF sources for importer validation --- crates/organize/src/import.rs | 11 ++++++++++- crates/organize/src/tests.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/crates/organize/src/import.rs b/crates/organize/src/import.rs index 931ec4f06a..416c86a2cf 100644 --- a/crates/organize/src/import.rs +++ b/crates/organize/src/import.rs @@ -584,8 +584,17 @@ pub fn page_as_form(dst: &mut Document, src: &Document, page: usize) -> Result<( // Use the viewer's effective bounds: an oversized CropBox must not reveal artwork // outside MediaBox or change the watermark's aspect ratio and fit (#7687). let source_page = pdfcraft_model::Page { obj: pr, dict: d }; - let bbox = source_page.crop(src); let d = &source_page.dict; + // Keep an explicitly empty source empty: callers such as 3D posters reject it. + // The viewer's Letter fallback must not turn that invalid input into a usable picture. + let raw_rect = |key: &[u8]| -> Option<[f64; 4]> { + let obj = src.resolve(d.get(key)?); + let [a, b, c, e] = obj.as_array()?.as_slice() else { return None }; + let [Some(x0), Some(y0), Some(x1), Some(y1)] = [a, b, c, e].map(|v| src.resolve(v).as_f64()) else { return None }; + [x0, y0, x1, y1].iter().all(|v| v.is_finite()).then(|| [x0.min(x1), y0.min(y1), x0.max(x1), y0.max(y1)]) + }; + let bbox = + raw_rect(b"CropBox").or_else(|| raw_rect(b"MediaBox")).filter(|b| b[0] == b[2] || b[1] == b[3]).unwrap_or_else(|| source_page.crop(src)); let (w, h) = (bbox[2] - bbox[0], bbox[3] - bbox[1]); let rotate = d.get(b"Rotate").and_then(|r| src.resolve(r).as_int()).unwrap_or(0).rem_euclid(360); // Content: the page's streams, decoded and joined. Of a stream damaged partway, the copy draws diff --git a/crates/organize/src/tests.rs b/crates/organize/src/tests.rs index 6f0e6560ca..e3d00b4802 100644 --- a/crates/organize/src/tests.rs +++ b/crates/organize/src/tests.rs @@ -5046,3 +5046,29 @@ fn page_form_clips_crop_to_media_before_rotation() { } } } + +/// Importers such as 3D posters must still be able to reject an explicitly empty source. +#[test] +fn page_form_keeps_explicit_zero_area_for_caller_validation() { + for key in [b"MediaBox".as_slice(), b"CropBox".as_slice()] { + for inherited in [false, true] { + let mut src = open(fixture()); + let page = pages(&src).unwrap()[0].obj; + src.update_dict(page, |d| d.set(b"Rotate".to_vec(), Object::Int(0))).unwrap(); + let target = if inherited { src.get(page).as_dict().unwrap().reference(b"Parent").unwrap() } else { page }; + if inherited { + src.update_dict(page, |d| { + d.remove(key); + }) + .unwrap(); + } + src.update_dict(target, |d| { + d.set(key.to_vec(), Object::Array(vec![20.into(), 30.into(), 100.into(), 30.into()])); + }) + .unwrap(); + let mut dst = Document::new_empty(); + let (_, size) = page_as_form(&mut dst, &src, 0).unwrap(); + assert_eq!(size, (80.0, 0.0)); + } + } +} From 3eada36579d6dc1be9d75b4d22e631a17b46f266 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Thu, 26 Nov 2026 20:48:47 +0700 Subject: [PATCH 6/6] fix(a11y): heading_levels builds after Evidence gained text and extent #7818 added heading_levels building autotag_roles::Evidence field by field; #7810 (merged just before) gave Evidence the text and extent fields, so main no longer compiles (E0063). Blocks carry neither, so they take the defaults. --- crates/a11y/src/heading_levels.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/a11y/src/heading_levels.rs b/crates/a11y/src/heading_levels.rs index 9934ec17f5..2c1de0369c 100644 --- a/crates/a11y/src/heading_levels.rs +++ b/crates/a11y/src/heading_levels.rs @@ -21,8 +21,10 @@ pub struct TextBlock { /// The heading level of each block, in document order: `Some(1)` to `Some(6)`, or `None` for a /// block that is not a heading. A heading's level is at most one deeper than the heading before. pub fn heading_levels(blocks: &[TextBlock]) -> Vec> { - let evidence: Vec = - blocks.iter().map(|b| Evidence { size: b.size, bold: b.bold, lines: b.lines, chars: b.chars, letters: b.letters }).collect(); + let evidence: Vec = blocks + .iter() + .map(|b| Evidence { size: b.size, bold: b.bold, lines: b.lines, chars: b.chars, letters: b.letters, ..Evidence::default() }) + .collect(); roles(&evidence).into_iter().map(|role| role.strip_prefix('H').and_then(|n| n.parse().ok())).collect() }