From 082502eeb05291413adda890caa6b134c1d36610 Mon Sep 17 00:00:00 2001 From: FerrisEanfar <38483336+FerrisEanfar@users.noreply.github.com> Date: Fri, 16 Oct 2026 11:03:16 -0600 Subject: [PATCH] fix(organize): keep attachments when inserting pages from a file --- ROADMAP.md | 1 + crates/engine/tests/insert_attachments.rs | 234 ++++++++++++++++++++++ crates/organize/src/import.rs | 44 ++-- docs/roadmap.md | 5 +- parity/acrobat-features.toml | 10 +- 5 files changed, 273 insertions(+), 21 deletions(-) create mode 100644 crates/engine/tests/insert_attachments.rs diff --git a/ROADMAP.md b/ROADMAP.md index 259dbfec04..d001bb99e0 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -157,6 +157,7 @@ Ranked; detail and the full milestone table in [docs/roadmap.md](docs/roadmap.md | 8 | 1.0 polish: performance, right-to-left, missing languages, keyboard-only (M14) | 55–95 | ## Progress log +- **2026-10-16 (M4, Insert from File):** Catalog attachments come along with inserted pages in the same undo step. Existing attachments and destination name trees stay; duplicate UTF-16 keys keep their encoding. Generated engine regressions cover save/undo/redo and failed-batch rollback. Estimates unchanged. - **2026-10-15 (M2, gap 12):** `cargo xtask text-oracle` scores reading order as well as word F1: the longest common subsequence of the two word sequences over the longer one. F1 is a bag of words and cannot see order at all -- measuring #2431, a change that moves text and nothing else, it called 26 of the 29 files whose output changed identical, where the order score separated 18 improvements from 6 regressions. Reports, does not gate; a disagreement with Poppler, not a verdict. Estimates unchanged. - **2026-10-15 (M2, #2305 follow-up):** WinAnsiEncoding 0xA0 and 0xAD and MacRomanEncoding 0xCA extract as the ordinary space and hyphen Annex D.2 names them, in the vendored hayro tables (patch 30) as well as `crates/fonts`, so search, copy and redaction see characters that were hidden behind U+00A0 and U+00AD. Across the pdf.js corpus the soft hyphens we extract fall 117 to 13 and the non-breaking spaces 30 to 26; the rest come from `/ToUnicode`. An explicit `/Differences` name keeps its glyph list value, as pdftotext does. Estimates unchanged. - **2026-10-13 (community, M3, #1569 review):** Pixel-only Wayland wheel, wheel-tilt and continuous input use standalone moved events, so Ctrl zoom does not remain latched after the modifier is released (#991); vendored winit patch (13), with a policy test. Estimates unchanged. diff --git a/crates/engine/tests/insert_attachments.rs b/crates/engine/tests/insert_attachments.rs new file mode 100644 index 0000000000..064ffc6e6e --- /dev/null +++ b/crates/engine/tests/insert_attachments.rs @@ -0,0 +1,234 @@ +use std::{collections::BTreeMap, sync::Arc}; + +use pdfcraft_cos::{Dict, Document, Object, PdfString, SaveOptions, Stream, write_full}; +use pdfcraft_engine::{Edit, Session}; +use pdfcraft_organize::FieldConflicts; + +fn dict(entries: [(&str, Object); N]) -> Dict { + let mut out = Dict::new(); + for (key, value) in entries { + out.set(key.as_bytes().to_vec(), value); + } + out +} + +fn packet(title: &str, attachment_key: Option>, indirect_names: bool) -> Arc> { + let mut doc = Document::new_empty(); + let pages = doc.add(Object::Null); + let font = doc.add(dict([("Type", Object::name("Font")), ("Subtype", Object::name("Type1")), ("BaseFont", Object::name("Helvetica"))])); + let body = format!("BT /F1 12 Tf 72 720 Td ({title}) Tj ET"); + let content = doc.add(Object::Stream(Stream::from_raw(Dict::new(), body.into_bytes()))); + let page = doc.add(dict([ + ("Type", Object::name("Page")), + ("Parent", Object::Ref(pages)), + ("MediaBox", Object::Array([0, 0, 612, 792].map(Object::Int).to_vec())), + ("Contents", Object::Ref(content)), + ("Resources", Object::Dict(dict([("Font", Object::Dict(dict([("F1", Object::Ref(font))])))]))), + ])); + doc.set(pages, dict([("Type", Object::name("Pages")), ("Kids", Object::Array(vec![Object::Ref(page)])), ("Count", Object::Int(1))])); + let destinations = doc.add(dict([( + "Names", + Object::Array(vec![Object::String(PdfString::text("PaymentSchedule")), Object::Array(vec![Object::Ref(page), Object::name("Fit")])]), + )])); + let mut names = dict([("Dests", Object::Ref(destinations))]); + if let Some(key) = attachment_key { + let payload = format!("{title}: vendor insurance verified; review owner Procurement Operations; next review 2027-01-31.\n"); + let file = doc.add(Object::Stream(Stream::from_raw( + dict([ + ("Type", Object::name("EmbeddedFile")), + ("Subtype", Object::name("text/plain")), + ("Params", Object::Dict(dict([("Size", Object::Int(payload.len() as i64))]))), + ]), + payload.into_bytes(), + ))); + let spec = doc.add(dict([ + ("Type", Object::name("Filespec")), + ("F", Object::String(PdfString::text("vendor-compliance.txt"))), + ("EF", Object::Dict(dict([("F", Object::Ref(file))]))), + ])); + let leaf = doc.add(dict([ + ("Names", Object::Array(vec![Object::String(PdfString::literal(key.clone())), Object::Ref(spec)])), + ("Limits", Object::Array(vec![Object::String(PdfString::literal(key.clone())), Object::String(PdfString::literal(key))])), + ])); + let tree = doc.add(dict([("Kids", Object::Array(vec![Object::Ref(leaf)]))])); + names.set(b"EmbeddedFiles".to_vec(), Object::Ref(tree)); + } + let names = if indirect_names { Object::Ref(doc.add(names)) } else { Object::Dict(names) }; + let root = doc.add(dict([("Type", Object::name("Catalog")), ("Pages", Object::Ref(pages)), ("Names", names)])); + doc.trailer_mut().set(b"Root".to_vec(), Object::Ref(root)); + Arc::new(write_full(&doc, &SaveOptions::default()).unwrap()) +} + +fn attachments(doc: &Document) -> Vec<(Vec, Vec)> { + fn visit(doc: &Document, tree: &Object, out: &mut Vec<(Vec, Vec)>) { + let tree = doc.resolve(tree); + let tree = tree.as_dict().unwrap(); + if let Some(names) = tree.get(b"Names") { + for pair in doc.resolve(names).as_array().unwrap().as_chunks::<2>().0 { + let key = pair[0].as_string().unwrap(); + let spec = doc.resolve(&pair[1]); + let ef = doc.resolve(spec.as_dict().unwrap().get(b"EF").unwrap()); + let file = doc.resolve(ef.as_dict().unwrap().get(b"F").unwrap()); + let Object::Stream(file) = file.as_ref() else { panic!("embedded file stream expected") }; + out.push((key.bytes.to_vec(), file.decoded().unwrap())); + } + } + if let Some(kids) = tree.get(b"Kids") { + for kid in doc.resolve(kids).as_array().unwrap() { + visit(doc, kid, out); + } + } + } + let catalog = doc.get(doc.root().unwrap()); + let names = doc.resolve(catalog.as_dict().unwrap().get(b"Names").unwrap()); + let mut out = Vec::new(); + if let Some(tree) = names.as_dict().unwrap().get(b"EmbeddedFiles") { + visit(doc, tree, &mut out); + } + out +} + +fn assert_destination_retained(doc: &Document) { + let catalog = doc.get(doc.root().unwrap()); + let names = doc.resolve(catalog.as_dict().unwrap().get(b"Names").unwrap()); + let dests = doc.resolve(names.as_dict().unwrap().get(b"Dests").expect("target destination tree retained")); + let values = dests.as_dict().unwrap().get(b"Names").unwrap().as_array().unwrap(); + assert_eq!(values[0].as_string().unwrap().to_text(), "PaymentSchedule"); + let page = values[1].as_array().unwrap()[0].as_ref().unwrap(); + assert_eq!(doc.get(page).as_dict().unwrap().name(b"Type"), Some(b"Page".as_slice())); +} + +fn insert(bytes: Arc>) -> Edit { + Edit::InsertPagesFrom { name: "Facilities Compliance Annex.pdf".into(), bytes, pages: None, at: 1, field_conflicts: FieldConflicts::Rename } +} + +#[test] +fn inserted_catalog_attachments_follow_native_undo_redo() { + let unicode = "合规审查.txt"; + let be: Vec = [0xfe, 0xff].into_iter().chain(unicode.encode_utf16().flat_map(u16::to_be_bytes)).collect(); + let le: Vec = [0xff, 0xfe].into_iter().chain(unicode.encode_utf16().flat_map(u16::to_le_bytes)).collect(); + for key in [b"vendor-compliance.txt".to_vec(), be, le] { + // Check raw keys to preserve the incoming encoding, including LE files + // whose labels PdfString::to_text does not currently decode. + let mut renamed = key.clone(); + match key.get(..2) { + Some([0xfe, 0xff]) => renamed.extend(" (2)".encode_utf16().flat_map(u16::to_be_bytes)), + Some([0xff, 0xfe]) => renamed.extend(" (2)".encode_utf16().flat_map(u16::to_le_bytes)), + _ => renamed.extend_from_slice(b" (2)"), + } + for indirect in [false, true] { + let target = packet("Facilities Service Agreement", Some(key.clone()), indirect); + let source = packet("Facilities Compliance Annex", Some(key.clone()), true); + let mut session = Session::new(); + session.set_javascript(false); + let id = session.open("Facilities Contract.pdf", None, target, None).unwrap(); + session.apply(id, Edit::Batch { label: "Merge Annex".into(), edits: vec![insert(source.clone())] }).unwrap(); + let bytes = session.save_bytes(id).unwrap(); + let merged = Document::open(bytes).unwrap(); + let entries = attachments(&merged); + assert_eq!(entries.len(), 2, "target and source attachments must survive"); + assert!(entries.windows(2).all(|p| p[0].0 < p[1].0), "name tree keys sorted and unique"); + let by_key: BTreeMap<_, _> = entries.into_iter().collect(); + assert!(by_key[&key].starts_with(b"Facilities Service Agreement:")); + assert!(by_key[&renamed].starts_with(b"Facilities Compliance Annex:")); + assert_destination_retained(&merged); + assert_eq!(session.get(id).unwrap().info.pages.len(), 2); + assert_eq!(session.get(id).unwrap().can_undo(), Some("Merge Annex")); + session.undo(id).unwrap(); + let undone = Document::open(session.save_bytes(id).unwrap()).unwrap(); + assert_eq!(attachments(&undone).len(), 1); + assert_destination_retained(&undone); + assert_eq!(session.get(id).unwrap().info.pages.len(), 1); + session.redo(id).unwrap(); + let redone = Document::open(session.save_bytes(id).unwrap()).unwrap(); + assert_eq!(attachments(&redone).len(), 2); + assert_destination_retained(&redone); + assert_eq!(session.get(id).unwrap().info.pages.len(), 2); + assert_eq!(attachments(&Document::open(source).unwrap()).len(), 1); + } + } +} + +#[test] +fn inserting_into_a_document_without_attachments_retains_other_names() { + let mut session = Session::new(); + session.set_javascript(false); + let id = session.open("Facilities Contract.pdf", None, packet("Facilities Service Agreement", None, true), None).unwrap(); + session.apply(id, insert(packet("Facilities Compliance Annex", Some(b"vendor-compliance.txt".to_vec()), true))).unwrap(); + let result = Document::open(session.save_bytes(id).unwrap()).unwrap(); + assert_eq!(attachments(&result).len(), 1); + assert_destination_retained(&result); + session.undo(id).unwrap(); + assert!(attachments(&Document::open(session.save_bytes(id).unwrap()).unwrap()).is_empty()); +} + +#[test] +fn inserting_without_source_attachments_does_not_rewrite_target_names() { + let mut session = Session::new(); + session.set_javascript(false); + let id = session + .open("Facilities Contract.pdf", None, packet("Facilities Service Agreement", Some(b"contract-evidence.txt".to_vec()), true), None) + .unwrap(); + let before = Document::open(session.save_bytes(id).unwrap()).unwrap(); + let names = before.get(before.root().unwrap()).as_dict().unwrap().get(b"Names").unwrap().clone(); + assert!(matches!(names, Object::Ref(_))); + session.apply(id, insert(packet("Facilities Payment Schedule", None, false))).unwrap(); + let after = Document::open(session.save_bytes(id).unwrap()).unwrap(); + assert_eq!(after.get(after.root().unwrap()).as_dict().unwrap().get(b"Names"), Some(&names)); + assert_eq!(attachments(&after), attachments(&before)); + assert_destination_retained(&after); +} + +#[test] +fn selecting_no_pages_does_not_import_catalog_attachments() { + let mut session = Session::new(); + session.set_javascript(false); + let id = session + .open("Facilities Contract.pdf", None, packet("Facilities Service Agreement", Some(b"contract-evidence.txt".to_vec()), true), None) + .unwrap(); + let before = Document::open(session.save_bytes(id).unwrap()).unwrap(); + session + .apply( + id, + Edit::InsertPagesFrom { + name: "Facilities Compliance Annex.pdf".into(), + bytes: packet("Facilities Compliance Annex", Some(b"vendor-compliance.txt".to_vec()), true), + pages: Some(Vec::new()), + at: 1, + field_conflicts: FieldConflicts::Rename, + }, + ) + .unwrap(); + assert_eq!(session.get(id).unwrap().info.pages.len(), 1); + let after = Document::open(session.save_bytes(id).unwrap()).unwrap(); + assert_eq!(attachments(&after), attachments(&before)); + assert_destination_retained(&after); +} + +#[test] +fn failed_insert_batch_rolls_back_pages_and_attachments() { + let mut session = Session::new(); + session.set_javascript(false); + let id = session + .open("Facilities Contract.pdf", None, packet("Facilities Service Agreement", Some(b"contract-evidence.txt".to_vec()), true), None) + .unwrap(); + assert!( + session + .apply( + id, + Edit::Batch { + label: "Merge Annex".into(), + edits: vec![ + insert(packet("Facilities Compliance Annex", Some(b"vendor-compliance.txt".to_vec()), true)), + Edit::RotatePages { pages: vec![99], degrees: 90 }, + ] + } + ) + .is_err() + ); + assert_eq!(session.get(id).unwrap().info.pages.len(), 1); + assert_eq!(session.get(id).unwrap().can_undo(), None); + let result = Document::open(session.save_bytes(id).unwrap()).unwrap(); + assert_eq!(attachments(&result).len(), 1); + assert_destination_retained(&result); +} diff --git a/crates/organize/src/import.rs b/crates/organize/src/import.rs index 588539866a..18b0df6f94 100644 --- a/crates/organize/src/import.rs +++ b/crates/organize/src/import.rs @@ -261,7 +261,8 @@ pub fn import_pages_with( /// under one new bookmark titled `title` (the file's name) at its first inserted page, as Combine /// Files does for each file. That bookmark goes among the top-level bookmarks where the pages went: /// before the first one that points after them. Bookmarks to pages left out lose their destination; -/// a file without bookmarks adds none. +/// a file without bookmarks adds none. Catalog attachments are merged with the destination's +/// attachments, with duplicate name-tree keys renamed, as in Combine Files. pub fn insert_file_pages( dst: &mut Document, src: &Document, @@ -281,6 +282,15 @@ pub fn insert_file_pages( let after = at.min(crate::page_count(dst)?.saturating_sub(imported.pages.len())).saturating_add(imported.pages.len()); insert_file_bookmark(dst, &Mark { title: title.to_string(), page: *first, outline }, after)?; } + if !imported.pages.is_empty() { + let mut incoming = Vec::new(); + collect_attachments(dst, src, &mut incoming)?; + if !incoming.is_empty() { + let mut attachments = attachment_entries(dst); + attachments.append(&mut incoming); + set_attachments(dst, attachments)?; + } + } Ok(ImportOutcome { pages: imported.pages, renamed_fields: imported.renamed_fields }) } @@ -1125,20 +1135,24 @@ pub fn combine_grouped_with(runs: &[Run<'_>], conflicts: FieldConflicts) -> Resu Ok(CombineOutcome { doc: out, renamed_fields }) } -/// Copy a source's document-level attachments (`/Names /EmbeddedFiles`) into `dst`. -fn collect_attachments(dst: &mut Document, src: &Document, out: &mut Vec<(Vec, Object)>) -> Result<(), OrganizeError> { +fn attachment_entries(src: &Document) -> Vec<(Vec, Object)> { let Some(tree) = src .root() .and_then(|r| src.get(r).as_dict().cloned()) .and_then(|c| c.get(b"Names").map(|n| src.resolve(n))) .and_then(|n| n.as_dict().and_then(|d| d.get(b"EmbeddedFiles").cloned())) else { - return Ok(()); + return Vec::new(); }; let mut entries = Vec::new(); name_tree_entries(src, &tree, 0, &mut entries); + entries +} + +/// Copy a source's document-level attachments (`/Names /EmbeddedFiles`) into `dst`. +fn collect_attachments(dst: &mut Document, src: &Document, out: &mut Vec<(Vec, Object)>) -> Result<(), OrganizeError> { let mut copier = Copier::new(src, HashMap::new(), HashMap::new()); - for (k, v) in entries { + for (k, v) in attachment_entries(src) { let v = copier.copy_value(dst, &v, None)?; out.push((k, v)); } @@ -1155,7 +1169,13 @@ fn set_attachments(dst: &mut Document, mut entries: Vec<(Vec, Object)>) -> R let base = k.clone(); let mut n = 2; while !seen.insert(k.clone()) { - *k = [base.as_slice(), format!(" ({n})").as_bytes()].concat(); + *k = base.clone(); + let suffix = format!(" ({n})"); + match base.get(..2) { + Some([0xfe, 0xff]) => k.extend(suffix.encode_utf16().flat_map(u16::to_be_bytes)), + Some([0xff, 0xfe]) => k.extend(suffix.encode_utf16().flat_map(u16::to_le_bytes)), + _ => k.extend_from_slice(suffix.as_bytes()), + } n += 1; } } @@ -1169,14 +1189,10 @@ fn set_attachments(dst: &mut Document, mut entries: Vec<(Vec, Object)>) -> R tree.set(b"Names".to_vec(), Object::Array(names)); let tree = dst.add(tree); let root = dst.root().ok_or(OrganizeError::NoPageTree)?; - dst.update_dict(root, |c| { - let mut n = match c.get(b"Names") { - Some(Object::Dict(d)) => d.clone(), - _ => Dict::new(), - }; - n.set(b"EmbeddedFiles".to_vec(), Object::Ref(tree)); - c.set(b"Names".to_vec(), Object::Dict(n)); - })?; + let catalog = dst.get(root); + let mut names = catalog.as_dict().and_then(|c| c.get(b"Names")).map(|n| dst.resolve(n)).and_then(|n| n.as_dict().cloned()).unwrap_or_default(); + names.set(b"EmbeddedFiles".to_vec(), Object::Ref(tree)); + dst.update_dict(root, |c| c.set(b"Names".to_vec(), Object::Dict(names)))?; Ok(()) } diff --git a/docs/roadmap.md b/docs/roadmap.md index 3dfea674f4..a548553011 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # PdfCraft roadmap: milestones and what's next -> **Last reviewed:** 2026-10-13 · **Last updated:** 2026-10-14 · **Change:** minor (M14: the Italian catalog has every entry the other catalogs had and the code looks up, 2,528 entries; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS) +> **Last reviewed:** 2026-10-13 · **Last updated:** 2026-10-16 · **Change:** patch (M4: Insert from File retains catalog attachments in its undo step; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS) > **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-13 · **Change:** minor (M2/M6: spot-colour images convert once per pixel value; widget placement and the Fields panel scale with the field count; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-14 · **Change:** minor (M3 candidate: coordinate control clicks on slow frames and coalesced text selection; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-15 · **Change:** minor (M2: sampled functions index a flat table, one image decode serves every zoom level, patch meshes copy less; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS) @@ -109,7 +109,7 @@ total matches the parity estimate. | M2 | Model, render, text | 200–350 | 15% | 130–230 | hayro bootstrap renderer (vendored patches); inspector predictor scratch is bounded by available input, and JPX sample rescaling handles 1–32 bits safely. Text extraction reaches word-F1 0.98 against pdftotext. Short same-line redraws split before placement rather than interleaving. A custom text match that ends on a reconstructed separator stops before the next glyph (#1315). Missing: model crate, fonts, DisplayList, renderer independent of hayro. Inspector page-label traversal and output are resource-bounded, with physical-number fallback warnings | | M2 | Model, render, text | 200–350 | 15% | 130–230 | hayro bootstrap renderer (vendored patches); Lab Bradford adaptation uses LMS white-point ratios, covered by independent neutral/chromatic and direct/Indexed render oracles; inspector predictor scratch is bounded by available input, and JPX sample rescaling handles 1–32 bits safely. Text extraction reaches word-F1 0.98 against pdftotext. Short same-line redraws split before placement rather than interleaving. Missing: model crate, fonts, DisplayList, renderer independent of hayro. Inspector page-label traversal and output are resource-bounded, with physical-number fallback warnings. Literal page-label prefix whitespace is preserved; nine public-inspection cases cover prefix spaces, encodings and empty-prefix controls | | M3 | Viewer app (native + web) | 80–150 | 90% | 10–20 | Acrobat-style shell, find, select, panels, tiles, web build, UI control channel for agents (opt-in). Missing: 60 fps test on a 500-page document, snapshot tests of every panel
Done since: fit visible, document title in the window; Linux middle-button scrolling; shared three-state theme preferences in the toolbar, View menu and control channel; numeric Linux portal events and idle wakeups completing #881, with native appearance inheritance retained (#446); late browser startup downloads preserve the current document and Save target (#171). | -| M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:
- command registry (menus, shortcuts and palette all use it);
- undo/redo; incremental, atomic and encrypted saves;
- autosave and crash recovery;
- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;
- CLI `edit/combine/extract/split`.
Done since: Organize opens directly into the page overview, with checkbox selection, an editable page-range selection (#1092), and per-page rotate/delete controls; Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Extract and Split preserve shared Type 3 glyph resource graphs, retaining conservative pruning limits. Undo back to the opened or last saved file is clean; Revert opens that saved file after an undo; a later save appends to it so the saved revision stays in the file (#1310, #1311, #1312). Missing: page transitions, recovery on the web | +| M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:
- command registry (menus, shortcuts and palette all use it);
- undo/redo; incremental, atomic and encrypted saves;
- autosave and crash recovery;
- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;
- CLI `edit/combine/extract/split`.
Done since: Organize opens directly into the page overview, with checkbox selection, an editable page-range selection (#1092), and per-page rotate/delete controls; Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Extract and Split preserve shared Type 3 glyph resource graphs, retaining conservative pruning limits. Undo back to the opened or last saved file is clean; Revert opens that saved file after an undo; a later save appends to it so the saved revision stays in the file (#1310, #1311, #1312). Insert from File retains catalog attachments in the same undo step, preserving existing destination name trees and duplicate-key encoding. Missing: page transitions, recovery on the web | | M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:
- command registry (menus, shortcuts and palette all use it);
- undo/redo; incremental, atomic and encrypted saves;
- autosave and crash recovery;
- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;
- CLI `edit/combine/extract/split`.
Done since: Organize opens directly into the page overview, with checkbox selection, an editable page-range selection (#1092), and per-page rotate/delete controls; Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Extract and Split preserve shared Type 3 glyph resource graphs, retaining conservative pruning limits. Missing: page transitions, recovery on the web M4: Insert-from-file preserves source bookmarks; integration tests retained with current main. | | M3 | Viewer app (native + web) | 80–150 | 90% | 10–20 | Acrobat-style shell, find, select, panels, tiles, web build, UI control channel for agents (opt-in). Missing: 60 fps test on a 500-page document, snapshot tests of every panel
Done since: fit visible, document title in the window; Linux middle-button scrolling; shared three-state theme preferences in the toolbar, View menu and control channel; numeric Linux portal events and idle wakeups completing #881, with native appearance inheritance retained (#446); late browser startup downloads preserve the current document and Save target (#171). Renderer-creation errors return to the existing OpenGL startup fallback; a real-GPU regression covers errors and device reuse. The underlying x86 DX12 shader compiler failure remains unresolved; see `windows-renderer-startup.md`. With Windows' Animation effects turned off, the wheel scrolls and zooms without easing and egui's animations take no time (`motion.rs`; macOS, Linux and the browser aren't asked yet); Preferences ▸ Animation effects (Use system setting, On, Off) decides it on every platform. | | M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:
- command registry (menus, shortcuts and palette all use it);
- undo/redo; incremental, atomic and encrypted saves;
- autosave and crash recovery;
- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;
- CLI `edit/combine/extract/split`.
Done since: Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Missing: page transitions, recovery on the web | @@ -179,6 +179,7 @@ M2 (renderer), M7 (content editing), M10 (OCR and Office), M11 (Preflight and st | Date | Change | Summary | |---|---|---| +| 2026-10-16 | patch | M4: Insert from File retains catalog attachments with native undo/redo; existing name trees and encoded duplicate keys survive. Estimates unchanged. | | 2026-10-15 | minor | M9 #1895: generic appearance rewriting deferred; separate validation overlays preserve original artwork, exports and printing. Baked captions remain unchanged (#79 open). Estimates unchanged. | | 2026-10-12 | minor | M6: valid AcroForm XML element names with original PDF field names preserved; saved-PDF collision and Unicode regressions. Estimates unchanged. | | 2026-10-12 | minor | M6: preserve carriage returns in exported CSV field names and values; saved-PDF round-trip coverage. Estimates unchanged. | diff --git a/parity/acrobat-features.toml b/parity/acrobat-features.toml index c3d319f94f..2b97b74e99 100644 --- a/parity/acrobat-features.toml +++ b/parity/acrobat-features.toml @@ -2716,8 +2716,8 @@ milestone = "M4" status = "shipped" commands = ["page.insert"] tools = ["page_insert_file"] -evidence = ["crates/organize/src/tests.rs::inserting_pages_from_another_file_is_an_incremental_edit", "crates/organize/src/tests.rs::inserting_a_file_brings_its_bookmarks_under_one_named_after_it", "crates/automation/tests/automation.rs::inserting_a_file_brings_its_bookmarks", "crates/ui-egui/tests/editing.rs::inserting_a_file_goes_after_the_selection_and_undoes", "crates/ui-egui/tests/editing.rs::plus_between_pages_inserts_picked_files_there_in_order"] -notes = "After the selection (toolbar, File menu) or at any gap of the page grid (a + between pages and at both ends); several files at once, in order; images and .txt files are converted first; the inserted pages end up selected. The file's bookmarks come along, collapsed under one named after the file, placed among the document's bookmarks where the pages went (as Combine does per file). The page_insert_file tool takes PDFs only. Missing: choosing which pages of the file to insert in the app; the file's tags (structure tree) are not merged." +evidence = ["crates/organize/src/tests.rs::inserting_pages_from_another_file_is_an_incremental_edit", "crates/organize/src/tests.rs::inserting_a_file_brings_its_bookmarks_under_one_named_after_it", "crates/automation/tests/automation.rs::inserting_a_file_brings_its_bookmarks", "crates/ui-egui/tests/editing.rs::inserting_a_file_goes_after_the_selection_and_undoes", "crates/ui-egui/tests/editing.rs::plus_between_pages_inserts_picked_files_there_in_order", "crates/engine/tests/insert_attachments.rs::inserted_catalog_attachments_follow_native_undo_redo"] +notes = "After the selection (toolbar, File menu) or at any gap of the page grid (a + between pages and at both ends); several files at once, in order; images and .txt files are converted first; the inserted pages end up selected. The file's bookmarks come along, collapsed under one named after the file, placed among the document's bookmarks where the pages went (as Combine does per file). Catalog attachments are merged with the document's existing attachments in the same undo step; colliding names are suffixed without changing their encoding. The page_insert_file tool takes PDFs only. Missing: choosing which pages of the file to insert in the app; the file's tags (structure tree) are not merged." [[feature]] id = "organize.insert-from-clipboard" @@ -3099,9 +3099,9 @@ tier = "P1" milestone = "M4" status = "shipped" commands = [] -tools = [] -evidence = ["crates/organize/src/tests.rs::combine_nests_source_bookmarks_and_keeps_attachments"] -notes = "" +tools = ["doc_combine", "page_insert_file"] +evidence = ["crates/organize/src/tests.rs::combine_nests_source_bookmarks_and_keeps_attachments", "crates/engine/tests/insert_attachments.rs::inserted_catalog_attachments_follow_native_undo_redo", "crates/engine/tests/insert_attachments.rs::inserting_into_a_document_without_attachments_retains_other_names"] +notes = "Also preserved by Insert from File, including native undo/redo and existing destination name trees. This covers catalog EmbeddedFiles, not PDF 2.0 associated-file relationships (AF)." [[feature]] id = "organize.field-name-conflicts"