mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-27 03:06:57 -06:00
Fix #526: the exports and the CLI write .ai as Save As does
file.saveAs and document.save wrote a PDF-compatible .ai, but document.export (and with it the CLI's run --export x.ai and convert in.svg out.ai, and MCP's export) refused it as a format that can only be opened, and --help didn't list it as writable. The .ai encoder is now shared: save.rs's ai_params and encode_ai (a PDF of every artboard with the PDF options, carrying the native document, blank pages with pdfCompatible: false) serve Save As and the exports alike. The .ai format is writable, so document.formats, --help and the MCP export tool list it; an export leaves the document's own path alone. Export As and Export for Screens keep leaving .ai to Save As. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
85319c972c
commit
1e2cb082ba
@@ -417,6 +417,12 @@ fn encode_files(doc: &Document, f: &Format, p: &Value) -> Result<Encoded> {
|
||||
"txt" => super::text::encode(doc, p)?,
|
||||
"svg" | "svgz" => return super::svg::encode(doc, p, f.id == "svgz").map_err(|e| bad(C, e)),
|
||||
"dxf" => return super::dxf::encode(doc, p, use_artboards),
|
||||
// As Save As writes it (a PDF of every artboard carrying the native document).
|
||||
"ai" => {
|
||||
let mut q = p.clone();
|
||||
super::save::ai_params(&mut q);
|
||||
return super::save::encode_ai(C, f, doc, &q);
|
||||
}
|
||||
// EPS reads its own `useArtboards` (the art's bounds unless asked).
|
||||
"eps" => return super::eps::encode(doc, p),
|
||||
"emf" => return super::metafile::encode(doc, p, use_artboards, vectorcraft_metafile::Kind::Emf),
|
||||
|
||||
Reference in New Issue
Block a user