Save: include a PDF in new native files by default

Squashed from #5320 onto main.
This commit is contained in:
dotCooCoo
2026-11-09 00:25:34 +07:00
committed by bflatastic
parent f5be571d47
commit d61a7abc96
18 changed files with 579 additions and 36 deletions
+5 -1
View File
@@ -4976,8 +4976,12 @@ or in `options` (`file.formatOptions {format}` lists them with their values):
- `includeLinked: true` keeps linked images' own pixels in the file (they stay linked), not just the previews.
- `embedProfiles` (default true) carries the ICC profiles the document is tagged with that were loaded from files;
opening the file installs them where they are missing (a warning names one that can't be used).
- `pdfCompatible`: native files (default false) also carry a PDF of every artboard (`pdf` in the file); `.ai` files
- `pdfCompatible`: native files (default true) also carry a PDF of every artboard (`pdf` in the file). This makes saves
larger and adds PDF rendering work. Set it to false to leave the PDF out; Save remembers that choice. `.ai` files
(default true) with false write blank pages around the native document (smaller; other apps show empty pages).
Native files without artboards and Data Recovery copies omit the PDF.
Reopening a native file keeps its saved PDF preference, falling back to whether it declared a PDF in older files.
Existing files saved without a PDF remain compact.
- `.ai` only: `compress` (default true) is the PDF option `compression.compressText`.
- The editing copy of a `.ai` or `.ait` file (`editingData`) names its active artboard (`CropAreaActive`): the active
artboard of the app's view when the app saves or exports the file, otherwise the artboard the document opened on (the
+2 -2
View File
@@ -282,8 +282,8 @@ object: its geometry (`type`, `path`, `fillRule`, `bounds`) and its `fills` and
from before these give geometry only). The paints are read only: an effect may draw as wide as a stroke or use a
fill's colour to decide its shape, but it changes only the geometry.
An **exporter** gets something else: the document as a native `.vectorcraft` file's JSON, as `document.save` writes it
but without indentation (the format is documented in [`crates/format/src/lib.rs`](../crates/format/src/lib.rs)). That is every layer, object,
An **exporter** gets something else: the native `.vectorcraft` document JSON without indentation, optional preview/PDF
renditions or save-preference metadata (the format is documented in [`crates/format/src/lib.rs`](../crates/format/src/lib.rs)). That is every layer, object,
appearance and effect record, artboard, swatch and symbol, so an exporter reads whatever the document holds; it checks
`version`, since a later host may write a newer one. Images of 8 KiB or more are listed in `images` with their MIME
type and `blob` but without their data, which follows the JSON in a saved file; smaller ones keep their base64 `data`.