PDF import: a PDF opened without its VectorCraft document saves under a new name

LoadOptions::is_partial now counts native off. A PDF saved with Preserve
Editing and opened from its pages instead of the document it carries kept
its save path, so Save wrote over the file and dropped that document.
Save now asks for a name, as for a page range or another box.
This commit is contained in:
dotCooCoo
2026-10-31 20:19:57 -07:00
parent 23005d4816
commit a015666bd5
2 changed files with 5 additions and 3 deletions
+3 -3
View File
@@ -99,10 +99,10 @@ impl LoadOptions {
}
/// Does the document read only part of the file, or read it differently (a page range, another
/// box, a password, without its hidden layers)? Writing it back would lose the rest, so Save
/// doesn't (it asks for a name).
/// box, a password, without its hidden layers, without the VectorCraft document it carries)?
/// Writing it back would lose the rest, so Save doesn't (it asks for a name).
pub fn is_partial(&self) -> bool {
self.pages.is_some() || self.crop != CropTo::default() || self.password.is_some() || !self.layers
self.pages.is_some() || self.crop != CropTo::default() || self.password.is_some() || !self.layers || !self.native
}
/// The PDF import options: `pages` resolved against the file's page count. A PDF-compatible
@@ -141,6 +141,8 @@ fn load_options_read_text_and_layers() {
assert!(o.is_partial(), "without its hidden layers, Save doesn't write the file back");
let d = LoadOptions::default();
assert_eq!((d.text_as, d.layers, d.is_partial()), (TextAs::Text, true, false));
let n = LoadOptions { native: false, ..Default::default() };
assert!(n.is_partial(), "without the document it carries, Save doesn't write the file back");
}
#[test]