diff --git a/crates/engine/src/cmd/place.rs b/crates/engine/src/cmd/place.rs index 83216b2f43..7a67773d0c 100644 --- a/crates/engine/src/cmd/place.rs +++ b/crates/engine/src/cmd/place.rs @@ -71,6 +71,8 @@ const MAX_QUEUE: usize = 100; const MAX_THUMBNAIL: f64 = 512.0; /// A text file's natural box (`file.place.info`, the place cursor): a letter page less 1 in margins. const TEXT_FRAME: Rect = Rect::new(0.0, 0.0, 468.0, 648.0); +/// An encrypted PDF's box in the place cursor, which reads it without its password: a letter page. +const LOCKED_PAGE: Rect = Rect::new(0.0, 0.0, 612.0, 792.0); pub fn specs() -> Vec { vec![ @@ -79,7 +81,7 @@ pub fn specs() -> Vec { "Place…", ["File"], Some("Cmd+Shift+P"), - "{path | name | dataBase64 (a file's path, or its name with its bytes), link?: true (a raster image keeps its file's path; a VectorCraft document at path becomes one locked placed document showing artboard `page`, linked to the file and read again when it changes (links.update; saving it in this app updates it at once), drawn as vectors in every output; so does a PDF/.ai page at path, showing its `crop` box, unless password or textAs: \"outlines\" is given; false: an editable copy of its art, as from dataBase64; other files are embedded), text?: {characterSet?: \"unicode\" (UTF-8, or UTF-16 with a byte-order mark, or without one by dataset.import's rule: an even length, at least half of its two-byte units holding a NUL byte, the byte order that reads a line break, valid UTF-16 with no NUL character; other bytes as the platform's 8-bit set) | \"ansi\" (the platform's 8-bit set), platform?: \"windows\" (Windows-1252) | \"mac\" (Mac Roman), removeLineReturns?: false (each block of lines becomes one paragraph; blank lines end paragraphs), removeParagraphReturns?: false (drop blank lines), replaceSpaces?: n (runs of n ≥ 2 spaces become a tab)} (a .txt file, placed as area type filling rect, the replaced object's bounds, or else the artboard less a 36 pt margin), template?: false (onto a new locked template layer below the current layer), replace?: false (swap the one selected object, keeping its stacking place and transform; no at/rect; refused while an object of a symbol instance's art is selected), at?: [x, y] centre (default: the first artboard's centre), rect?: [x, y, width, height] fit inside; aspect kept (wins over at), page?: 1 (PDF/.ai page, or a native document's artboard), crop?: \"crop\" (clipped to that page or artboard, default; an SVG, only when given: framed and clipped by its viewBox, else by its art's bounds) | \"bounding\" (the bounds of the art that shows, with its strokes and effects, as an export measures them: hidden objects and guides left out) | \"art\" | \"trim\" | \"bleed\" | \"media\" (a PDF page's boxes), password? (an encrypted PDF), layers?: false (a PSD or PSB file: true embeds its layers as one group named after the file, read as document.open reads them: an image for each layer and a group for each layer group, with the layer's name, visibility, opacity, blend mode and opacity mask, at the place its merged image would take and clipped to the canvas when layers, hidden ones included, reach past it; never linked: link is then false unless given, and link: true is refused; a file without layers is embedded as its merged image, and so are one whose layers are all left out and one whose layers can't be read, with a warning), hiddenLayers?: false (with layers: true, the hidden layers come in hidden instead of being left out; refused without it), importSlices?: bool (a PSD or PSB file: its slices become user slices, moved and scaled with the placed art, in the same undo step; default true when the file is embedded, false when it is linked, and true with link is refused; slices the file generated automatically are left out), dxf?: {…the DXF options of document.open} (a .dxf drawing: fit fills the artboard under at, else the first; fitted or uncentred art lands with its drawing's artboard on that artboard, else it is centred on at), showImportOptions?: true (in the app, a text file without text, a DXF drawing without dxf, a PSD or PSB file embedded without layers (with two layers or more, or with slices) and a PDF with several pages or a password and no page ask for those options first; false places them with the options last confirmed, a PDF on page 1 (or page), and asks only an encrypted PDF's password)} → {ids, name, format, linked, width, height, warnings, image?: the id of the image of a DCS file or PSD/PSB file placed in a clip group, which the Links commands take, slices?: [the ids of the user slices a PSD file brought in]}. A PSD or PSB file that names a clipping path places in a clip group of that path (even-odd), as does its merged image in document.open. Raster images come in at 100% of their physical size (the file's ppi, else 72); SVG, DXF, HP-GL (.plt, .hpgl, .hgl, .hpg), PDF/.ai, EMF/WMF and PICT (.pct, .pic, .pict; clipped to the picture's frame), EPS (clipped to its bounding box; as document.open reads it), a .ai saved without PDF compatibility (from its editing data, as document.open reads it: the art of the layers that show on artboard `page`, clipped to that artboard unless crop is \"bounding\") and native documents as one group, with the images, symbols, patterns, swatches and brushes they use. A DCS file (an EPS file with one program per printing plate, DCS 1.0 or 2.0) is placed only from its path with link (else an error, as are document.open and links.embed): one linked image of its plates mixed into CMYK, clipped by the clipping path its composite is drawn through, its spot plates added as spot swatches in the process equivalents the file gives (a swatch of the same name is kept, with a warning); print separations and Separations Preview show each plate on its own ink, and plate files of their own are read from its folder. One undo step; selects what it placed (unless on a template layer); never touches the clipboard. A PNG, JPEG, GIF or WebP image whose pixels can't be read (a file cut short) is an error, and nothing is placed", + "{path | name | dataBase64 (a file's path, or its name with its bytes), link?: true (a raster image keeps its file's path; a VectorCraft document at path becomes one locked placed document showing artboard `page`, linked to the file and read again when it changes (links.update; saving it in this app updates it at once), drawn as vectors in every output; so does a PDF/.ai page at path, showing its `crop` box, unless password or textAs: \"outlines\" is given; false: an editable copy of its art, as from dataBase64; other files are embedded), text?: {characterSet?: \"unicode\" (UTF-8, or UTF-16 with a byte-order mark, or without one by dataset.import's rule: an even length, at least half of its two-byte units holding a NUL byte, the byte order that reads a line break, valid UTF-16 with no NUL character; other bytes as the platform's 8-bit set) | \"ansi\" (the platform's 8-bit set), platform?: \"windows\" (Windows-1252) | \"mac\" (Mac Roman), removeLineReturns?: false (each block of lines becomes one paragraph; blank lines end paragraphs), removeParagraphReturns?: false (drop blank lines), replaceSpaces?: n (runs of n ≥ 2 spaces become a tab)} (a .txt file, placed as area type filling rect, the replaced object's bounds, or else the artboard less a 36 pt margin), template?: false (onto a new locked template layer below the current layer), replace?: false (swap the one selected object, keeping its stacking place and transform; no at/rect; refused while an object of a symbol instance's art is selected), at?: [x, y] centre (default: the first artboard's centre), rect?: [x, y, width, height] fit inside; aspect kept (wins over at), page?: 1 (PDF/.ai page, or a native document's artboard), crop?: \"crop\" (clipped to that page or artboard, default; an SVG, only when given: framed and clipped by its viewBox, else by its art's bounds) | \"bounding\" (the bounds of the art that shows, with its strokes and effects, as an export measures them: hidden objects and guides left out) | \"art\" | \"trim\" | \"bleed\" | \"media\" (a PDF page's boxes), password? (an encrypted PDF), layers?: false (a PSD or PSB file: true embeds its layers as one group named after the file, read as document.open reads them: an image for each layer and a group for each layer group, with the layer's name, visibility, opacity, blend mode and opacity mask, at the place its merged image would take and clipped to the canvas when layers, hidden ones included, reach past it; never linked: link is then false unless given, and link: true is refused; a file without layers is embedded as its merged image, and so are one whose layers are all left out and one whose layers can't be read, with a warning), hiddenLayers?: false (with layers: true, the hidden layers come in hidden instead of being left out; refused without it), importSlices?: bool (a PSD or PSB file: its slices become user slices, moved and scaled with the placed art, in the same undo step; default true when the file is embedded, false when it is linked, and true with link is refused; slices the file generated automatically are left out), dxf?: {…the DXF options of document.open} (a .dxf drawing: fit fills the artboard under at, else the first; fitted or uncentred art lands with its drawing's artboard on that artboard, else it is centred on at), showImportOptions?: true (in the app, a text file without text, a DXF drawing without dxf, a PSD or PSB file embedded without layers (with two layers or more, or with slices) and a PDF with several pages or a password and no page ask for those options first, and an encrypted PDF given page and no password asks for its password; false places them with the options last confirmed, a PDF on page 1 (or page), and asks only an encrypted PDF's password)} → {ids, name, format, linked, width, height, warnings, image?: the id of the image of a DCS file or PSD/PSB file placed in a clip group, which the Links commands take, slices?: [the ids of the user slices a PSD file brought in]}. A PSD or PSB file that names a clipping path places in a clip group of that path (even-odd), as does its merged image in document.open. Raster images come in at 100% of their physical size (the file's ppi, else 72); SVG, DXF, HP-GL (.plt, .hpgl, .hgl, .hpg), PDF/.ai, EMF/WMF and PICT (.pct, .pic, .pict; clipped to the picture's frame), EPS (clipped to its bounding box; as document.open reads it), a .ai saved without PDF compatibility (from its editing data, as document.open reads it: the art of the layers that show on artboard `page`, clipped to that artboard unless crop is \"bounding\") and native documents as one group, with the images, symbols, patterns, swatches and brushes they use. A DCS file (an EPS file with one program per printing plate, DCS 1.0 or 2.0) is placed only from its path with link (else an error, as are document.open and links.embed): one linked image of its plates mixed into CMYK, clipped by the clipping path its composite is drawn through, its spot plates added as spot swatches in the process equivalents the file gives (a swatch of the same name is kept, with a warning); print separations and Separations Preview show each plate on its own ink, and plate files of their own are read from its folder. One undo step; selects what it placed (unless on a template layer); never touches the clipboard. A PNG, JPEG, GIF or WebP image whose pixels can't be read (a file cut short) is an error, and nothing is placed", has_doc, place ), @@ -106,7 +108,7 @@ pub fn specs() -> Vec { "Load Place Cursor", [], None, - "{paths?: [path…], files?: [{name, dataBase64}…], link?, template?, page?, crop?, text?, dxf?, layers?, hiddenLayers?, importSlices?, thumbnail?: px} load the place cursor (the `place` tool) with up to 100 files (as file.place reads them): a click places the current file at 100% with its top-left corner there, a drag places it at the dragged size (aspect kept), ←/→ and ↑/↓ cycle the files, Esc discards the current one; each placement is a file.place, and the previous tool returns after the last → {count, files: [{name, format, width, height, thumbnailBase64?}], skipped: [{name, error}]}", + "{paths?: [path…], files?: [{name, dataBase64}…], link?, template?, page?, crop?, text?, dxf?, layers?, hiddenLayers?, importSlices?, thumbnail?: px} load the place cursor (the `place` tool) with up to 100 files (as file.place reads them): a click places the current file at 100% with its top-left corner there, a drag places it at the dragged size (aspect kept), ←/→ and ↑/↓ cycle the files, Esc discards the current one; each placement is a file.place, and the previous tool returns after the last; an encrypted PDF, .ai or .ait file stays in the cursor at 612 × 792 pt (VectorCraft's own size) with needsPassword: true and no thumbnail, and a click on it in the app asks for its password (headless, its file.place fails for want of the password) → {count, files: [{name, format, width, height, thumbnailBase64?, needsPassword?}], skipped: [{name, error}]}", has_doc, queue ), @@ -988,6 +990,14 @@ fn read_queue(doc: u64, p: Value, queued: Vec) -> Result { } Err(e) => { let name = str_param(&q, "path").or(str_param(&q, "name")).map(fileio::file_name).unwrap_or_default(); + // An encrypted PDF stays, at a size of its own, so that a click in the app can ask + // for its password. + if let Some(format) = locked_pdf(&q, &e) { + let (w, h) = (LOCKED_PAGE.width(), LOCKED_PAGE.height()); + files.push(json!({ "name": name, "format": format, "width": w, "height": h, "needsPassword": true })); + entries.push(json!({ "params": q, "name": name, "width": w, "height": h })); + continue; + } skipped.push(json!({ "name": name, "error": e.to_string() })); } } @@ -995,6 +1005,22 @@ fn read_queue(doc: u64, p: Value, queued: Vec) -> Result { Ok(QueueRead { doc, params: p, entries, files, skipped }) } +/// The format id of the file `q` names when it is a PDF, `.ai` or `.ait` file (a path with one of +/// those extensions, as the app's password dialog reads it) that opens only with a password, and +/// reading it failed with `e` for want of that password (not for a bad option). +fn locked_pdf(q: &Value, e: &EngineError) -> Option<&'static str> { + if !e.to_string().contains(&vectorcraft_pdf::PdfError::NeedsPassword.to_string()) { + return None; + } + let src = fileio::source(q, QUEUE).ok()?; + if src.path.is_some() && !matches!(fileio::extension(src.name).as_str(), "pdf" | "ai" | "ait") { + return None; + } + let format = fileio::detect(src.name, &src.bytes)?; + let locked = matches!(vectorcraft_pdf::open_pdf(&src.bytes, None).map(|_| ()), Err(vectorcraft_pdf::PdfError::NeedsPassword)); + (matches!(format.id, "pdf" | "ai" | "ait") && locked).then_some(format.id) +} + impl Session { /// `file.place.queue`'s checks (with no document open, the error `file.place.queue` gives) of /// `params` → what reads the files ([`QueueJob::read`]; on the diff --git a/crates/engine/src/tests/place.rs b/crates/engine/src/tests/place.rs index 8dbe06f349..cade51bca6 100644 --- a/crates/engine/src/tests/place.rs +++ b/crates/engine/src/tests/place.rs @@ -1101,6 +1101,35 @@ fn the_place_queue_skips_an_image_whose_pixels_cant_be_read() { assert_eq!(b.place_queue_read(read).unwrap(), r); } +/// An encrypted PDF stays in the place cursor's queue, read with the session or apart from it, at +/// a letter page's size with `needsPassword`, so that a click in the app can ask for its password; +/// headless, a click on it places nothing. +#[test] +fn the_place_queue_keeps_an_encrypted_pdf() { + use vectorcraft_testkit::pdf::{PdfPage, pdf}; + let locked = pdf(&[PdfPage::new(100.0, 50.0, "0 g 0 0 10 10 re f")], Some("pw")); + let p = json!({"files": [file("locked.pdf", &locked), file("a.png", &png(40, 20, [9, 9, 9, 255], None))], "thumbnail": 8}); + let (mut a, mut b) = (session(), session()); + let r = a.execute("file.place.queue", &p).unwrap(); + assert_eq!((&r["count"], &r["skipped"]), (&json!(2), &json!([])), "{r}"); + assert_eq!(r["files"][0], json!({"name": "locked.pdf", "format": "pdf", "width": 612.0, "height": 792.0, "needsPassword": true})); + assert!(r["files"][1].get("needsPassword").is_none()); + let read = b.prepare_place_queue(&p).unwrap().read().unwrap(); + assert_eq!(b.place_queue_read(read).unwrap(), r); + let view = ViewInfo::default(); + assert_eq!(a.tool_options()["name"], "locked.pdf"); + let _ = a.pointer(&PointerEvent::new(PointerKind::Down, 10.0, 10.0), view); + let _ = a.pointer(&PointerEvent::new(PointerKind::Up, 10.0, 10.0), view); + assert_eq!((top_children(&a).len(), a.doc().unwrap().history.undo.len()), (0, 0), "nothing placed without the password"); + // An encrypted PDF with a bad option is refused for the option, not kept. + let e = a.execute("file.place.queue", &json!({"files": [file("locked.pdf", &locked)], "page": 0})).unwrap_err().to_string(); + assert!(e.contains("page must be a whole number from 1"), "{e}"); + // A PDF that can't be read for another reason is still skipped. + let broken = file("broken.pdf", b"%PDF-1.7\nnot a PDF body\n"); + let r = a.execute("file.place.queue", &json!({"files": [broken, file("b.png", &png(4, 4, [0; 4], None))]})).unwrap(); + assert_eq!((&r["count"], &r["skipped"][0]["name"]), (&json!(1), &json!("broken.pdf")), "{r}"); +} + /// The place queue's thumbnail of an image is drawn from the pixels its check decoded, so each /// image is decoded once. #[test] diff --git a/crates/ui-egui/src/place.rs b/crates/ui-egui/src/place.rs index 80c2464f62..54be279e09 100644 --- a/crates/ui-egui/src/place.rs +++ b/crates/ui-egui/src/place.rs @@ -74,8 +74,11 @@ pub struct PlaceState { queue_asks: bool, /// The loaded cursor's files by name, with the size a click places them at. queue_sizes: Vec<(String, f64, f64)>, + /// The names of the loaded cursor's encrypted PDF files, which ask for their password. + queue_locked: Vec, /// The engine's count of cursor loads ([`vectorcraft_engine::Session::place_queue_loads`]) when - /// `queue_asks` and `queue_sizes` were set: a later load (`tool.setOption`, a script) clears them. + /// `queue_asks`, `queue_sizes` and `queue_locked` were set: a later load (`tool.setOption`, a + /// script) clears them. queue_load: u64, /// The import options dialog a click of the cursor opened (the token in its params' /// [`ASKED`]), with the automation roots the cursor was loaded in: its OK, pressed outside any @@ -202,8 +205,8 @@ fn place_file_in(app: &mut VectorcraftApp, p: &Value, read: Read) -> Result R /// The file a click or drag of the place cursor places (`file.place` with `p`, its `rect` set): /// read off the UI thread where the files the user places are ([`crate::placing::start`]), else at /// once. When the Place dialog loaded the cursor with Show Import Options on, a file that has -/// import options asks for them first (Cancel leaves it unplaced). An error shows in the status bar. +/// import options asks for them first (Cancel leaves it unplaced); otherwise only an encrypted PDF +/// asks, for its password. An error shows in the status bar. pub(crate) fn place_from_cursor(app: &mut VectorcraftApp, p: &Value) { // Read within the automation roots of whoever loaded the cursor, even on a click of the person // at the keyboard: an agent's queue reaches no file it wasn't given. let roots = app.session.place_queue_roots(); forget_older_queue(app); vectorcraft_engine::file_access::confine(roots.as_ref(), || { - if app.place.queue_asks { + let locked = is_locked(app, p); + if app.place.queue_asks || locked { let mut p = clicked_at_full_size(app, p); + if !app.place.queue_asks { + // Only its password is asked for, as File › Place with Show Import Options off. + p["showImportOptions"] = json!(false); + } // The import options it may ask for keep the token, and their OK places within the // same roots ([`place_file`]). app.place.asked = roots.clone().map(|r| { @@ -498,10 +507,17 @@ fn forget_older_queue(app: &mut VectorcraftApp) { if app.place.queue_load != app.session.place_queue_loads() { app.place.queue_asks = false; app.place.queue_sizes.clear(); + app.place.queue_locked.clear(); app.place.asked = None; } } +/// Does `p` (a cursor click's `file.place` params) name a file the cursor holds as an encrypted PDF? +fn is_locked(app: &VectorcraftApp, p: &Value) -> bool { + let name = p.get("path").or_else(|| p.get("name")).and_then(Value::as_str).map(fileio::file_name); + name.is_some_and(|n| app.place.queue_locked.contains(&n)) +} + /// The params of a cursor click (`rect` at the file's queued size) on a PDF or DXF file, whose /// import options may change its size (another page, another scale): placed as its options place /// it at the click (`at`, the center of the box the click gave), as File › Place of that one file @@ -538,6 +554,13 @@ pub(crate) fn show_thumbnails(app: &mut VectorcraftApp, r: &Value, asks: bool) { .flatten() .filter_map(|f| Some((f["name"].as_str()?.to_string(), f["width"].as_f64()?, f["height"].as_f64()?))) .collect(); + app.place.queue_locked = r["files"] + .as_array() + .into_iter() + .flatten() + .filter(|f| f["needsPassword"] == true) + .filter_map(|f| Some(f["name"].as_str()?.to_string())) + .collect(); app.place.thumbs = r["files"] .as_array() .into_iter() diff --git a/crates/ui-egui/src/tests/place.rs b/crates/ui-egui/src/tests/place.rs index f470ef49bc..0141f69403 100644 --- a/crates/ui-egui/src/tests/place.rs +++ b/crates/ui-egui/src/tests/place.rs @@ -1071,6 +1071,61 @@ fn the_place_cursors_files_ask_for_their_import_options_when_show_import_options assert_eq!(dialog_kind(&app), None); } +/// An encrypted PDF in the place cursor asks for its password when clicked, with Show Import +/// Options on or off, and the password's OK places it where the click put it. +#[test] +fn an_encrypted_pdf_in_the_place_cursor_asks_for_its_password_when_clicked() { + let mut app = app(); + let dir = Folder::new("ui-place-cursor-encrypted-pdf"); + let a = dir.file("a.png", &png(10, 10, 72.0)); + let pages = [PdfPage::new(100.0, 100.0, "0 g 0 0 10 10 re f"), PdfPage::new(300.0, 100.0, "1 0 0 rg 0 0 30 30 re f")]; + let locked = dir.file("locked.pdf", &pdf(&pages, Some("pw"))); + // The click gives the box of the size the cursor holds it at, a letter page. + let click = json!({"path": locked, "link": false, "rect": [10, 10, 612, 792]}); + let center = vectorcraft_geom::Point::new(316.0, 406.0); + let placed = |app: &VectorcraftApp| { + let st = app.session.active().unwrap(); + let b = st.doc.node(st.selection.objects[0]).unwrap().geometric_bounds().unwrap(); + (b.width().round(), b.center()) + }; + for show in [false, true] { + app.run("file.place", json!({"paths": [a, locked]})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("showImportOptions".into(), json!(show)); + d.fields.insert("link".into(), json!(false)); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(app.session.tool_options()["count"], 2, "kept in the cursor"); + crate::place::place_from_cursor(&mut app, &click); + let d = app.ui.dialog.as_mut().expect("the password dialog"); + assert!(d.bool("__locked")); + assert_eq!(d.fields["__place"], json!({"link": false, "at": [316.0, 406.0]})); + d.fields.insert("password".into(), json!("pw")); + crate::dialogs::confirm(&mut app).unwrap(); + if show { + // Unlocked, it asks for the page. + assert_eq!(dialog_kind(&app), Some("importPdf")); + crate::dialogs::confirm(&mut app).unwrap(); + } + assert_eq!((dialog_kind(&app), placed(&app)), (None, (100.0, center)), "Show Import Options {show}"); + } + // A cursor loaded by file.place.queue asks too, also with a `page`, which it then places. + app.run("file.place.queue", json!({"paths": [a, locked], "link": false, "page": 2})).unwrap(); + crate::place::place_from_cursor(&mut app, &json!({"path": locked, "link": false, "page": 2, "rect": [10, 10, 612, 792]})); + let d = app.ui.dialog.as_mut().expect("the password dialog"); + assert!(d.bool("__locked")); + d.fields.insert("password".into(), json!("pw")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((dialog_kind(&app), placed(&app).0), (None, 300.0), "page 2"); + // File › Place of it with a `page` and Show Import Options on asks for the password too. + crate::place::run_for_user(&mut app, &json!({"path": locked, "link": false, "page": 1})).unwrap(); + assert!(app.ui.dialog.as_ref().is_some_and(|d| d.bool("__locked"))); + app.ui.dialog = None; + // An encrypted PDF whose name has no PDF extension is still left out of the cursor. + let misnamed = dir.file("locked.dat", &pdf(&pages, Some("pw"))); + let r = app.run("file.place.queue", json!({"paths": [a, misnamed]})).unwrap(); + assert_eq!((&r["count"], &r["skipped"][0]["name"]), (&json!(1), &json!("locked.dat")), "{r}"); +} + /// A cursor loaded again after the Place dialog loaded it with Show Import Options on (a queue set /// on the Place tool) places its files at once. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index ac0a768306..281fe5b650 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -7183,7 +7183,10 @@ that draws the image does not decode the file again. `file.place.info` describes a file without placing it and `image.info` reports a placed image's link, colour mode and effective ppi. `file.place.queue` loads the place cursor (the `place` tool) with several files: headless, drive it with `pointer_gesture` (a click places at 100% with the top-left corner there, a drag at the dragged size) and -`press_key` (Left/Right/Up/Down cycle, Escape discards the current file). `file.place`, `file.place.queue` and +`press_key` (Left/Right/Up/Down cycle, Escape discards the current file). The cursor keeps an encrypted PDF, `.ai` +or `.ait` file that it cannot read without the password, at 612 × 792 pt (VectorCraft's own size) with +`needsPassword: true` and no thumbnail; in the app a click or drag on it asks for the password, and headless it places +nothing. `file.place`, `file.place.queue` and `file.place.info` refuse, of the keys each one takes, a `link`, `replace` or `template` that is not true or false and a `thumbnail` that is not a number, naming the key, and place nothing; null is the same as leaving the key out. @@ -7194,7 +7197,8 @@ slices (Place PSD). `showImportOptions: false` places such a file without asking its dialog: the text options, the DXF fit, lineweight, centering and layer choices with the drawing at 1:1 in its own unit, and the PSD conversion, hidden-layer and Import Slices choices. A PDF is placed on page 1 (or `page`) and its crop box, and an encrypted PDF given no -`password` still asks for the password. A `showImportOptions` that is not true or false is refused, and nothing is placed. The +`password` still asks for the password. An encrypted PDF given a `page` and no `password` asks for the password with +Show Import Options on too, and places that page. A `showImportOptions` that is not true or false is refused, and nothing is placed. The Place dialog (File › Place, or `file.place {paths}`) has a Show Import Options checkbox after Link, Template and Replace ([Place multiple files in a document](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-other-file-types/place-multiple-files-in-a-document.html)). It is on by default and saved with the preferences. On, each file that has import options asks for them before it is diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 72de21a43c..bb91b61316 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1905,6 +1905,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Placed documents: File › Place of a `.vectorcraft` file links to it by default (`file.place`'s `link`): one locked object showing an artboard of the document (or its art's bounds), read the way placing it without Link reads it, its symbols, patterns and images kept apart from the document's; without Link (or from bytes, not a file) it is an editable copy as before. It stays vectors in every output (SVG, PDF, EPS, EMF, DXF), and so do placed documents inside it, read from their own files up to 8 levels deep (documents that place each other stop there). On screen they draw from bitmaps cached per file and zoom step, shared by every copy and made in the background (a placeholder until ready), so a sheet of them redraws in about a millisecond; exports and prints draw them exactly. Like linked images, a save keeps only a preview of each (JPEG when opaque) unless Include Linked Files; output, and zooming past the preview, read the file again, falling back to the preview with a warning when it is gone or changed. Saves for older versions write them as plain art. Links check, update, relink, Update Links on open, Link Info (the artboard's size), Placement Options, Break Link (also Embed, Object › Expand: the editable copy placing without Link gives, its resources joining the document), Edit Original (the document in a new tab) and the Links panel cover them; saving a document updates the open documents that place it. The native format (v4) keeps data of 8 KB or more after the JSON instead of base64 in it. - Placed documents' bitmaps on screen: when a bitmap made in the background is ready, the desktop app renders the canvas again only where the objects that show its file are, when the frame shown was rendered on the UI thread and that part is at most half the canvas. Bitmaps drawn or made since a frame began are kept for that frame past the 512 MiB budget, up to 2 GiB, so a view showing more than the budget does not make them again in every frame. A bitmap that would take them past 2 GiB is not kept, and its file draws exactly at that zoom. A bitmap that can't be made (the file can't be read and there is no preview) shows the light placeholder and is not asked for again. Each ready bitmap used to render the whole canvas again, and bitmaps past the budget and bitmaps that could not be made were asked for again in every frame (`crates/render/src/tests/placed_document.rs`). - Linked PDF and `.ai` pages: File › Place with Link (the default) places a page of a PDF, `.ai` or `.ait` file read as PDF pages as a placed document, as it links an image, the page and its box (`crop`) kept with the link: Links check, update and relink it, Break Link and Object › Expand give the group placing it without Link gives, every output draws the page's vectors, and Package copies the file. Without Link, or with a password or `textAs: "outlines"`, the page is embedded. EPS and PostScript `.ai` files are still embedded (`crates/engine/src/tests/placed_document.rs`). + - The place cursor keeps an encrypted PDF, `.ai` or `.ait` file, at a letter page's size (VectorCraft's own size) and without a thumbnail, and a click or drag on it asks for its password, with the Place dialog's Show Import Options on or off; such a file was left out of the cursor before (`crates/engine/src/tests/place.rs`, `crates/ui-egui/src/tests/place.rs`). - File › Place with Bounding Box (`file.place {crop: "bounding"}`) measures the art that shows, with its strokes and effects, as an export does: hidden objects, guides and template layers do not count, a group whose only part on the page or artboard is hidden is not placed, and symbol instances are measured by their art, for `at`, `rect`, the place cursor and `file.place.info` (`crates/engine/src/tests/place.rs`). - The Place dialog has a Show Import Options checkbox after Link, Template and Replace ([Place multiple files in a document](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-other-file-types/place-multiple-files-in-a-document.html)). On (VectorCraft's default, saved with the preferences), each PDF, DXF or text file asks for its import options before it is placed, also in the place cursor; off (`file.place {showImportOptions: false}`), it is placed with the options last confirmed for its format, and only an encrypted PDF asks, for its password. Text Import Options now starts from the options confirmed last (`crates/ui-egui/src/tests/place.rs`). - Separations Preview shows placed and embedded raster images on the visible plates, as it shows vector art (#4153): an RGB image's pixels are separated into process inks with the proof setup's intent, a CMYK image shows its own inks, a hidden plate's ink leaves the image, and with one plate visible the image shows that plate's ink as a grey. Raster images carry no spot ink, so a spot plate shown alone shows them as paper; a colorized image shows its color's plates. Emoji and other bitmap glyphs follow the same rule. The plate-filtered pixels and their reduced-size copies are kept apart from the image's own pixels, for each set of visible plates, proof setup and color settings, and with the preview off nothing changes. Evidence: `tests::colorize::separations_preview_shows_an_rgb_images_process_inks`, `separations_preview_shows_a_cmyk_images_own_inks`, `separations_preview_keeps_an_images_pixels_per_plate_set`. Print preview fidelity remains the open gap, so scores and hours are unchanged.