mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-26 02:37:01 -06:00
PDF export: PDF and .ai files keep the document's creation date
The engine built the PDF options without a creation date, so the writer dated every PDF and PDF-compatible .ai file with the time it was written. A document created on 2020-01-01 (File › File Info shows the date) exported as a PDF with today's date in /CreationDate and xmp:CreateDate. SVG export with the metadata option already writes the document's own date. The options now carry the document's File Info created date and the time of writing as the modification date. A document without a creation date is dated with the time of writing, as before, so PDF/X files still get their required date. The PDF writer writes one date for both, so the export then sets /ModDate, xmp:ModifyDate and the PDF/A history dates to the time of writing; /CreationDate and xmp:CreateDate keep the document's date. The page information mark and the embedded editing data's modification date keep the time of writing. Docs: docs/mcp.md (File Info), docs/target-app-parity.md.
This commit is contained in:
@@ -235,11 +235,15 @@ pub fn expand_preset<'a>(s: &Session, cmd: &str, p: &'a Value) -> Result<Cow<'a,
|
||||
super::eps::with_flattener(s, cmd, expanded)
|
||||
}
|
||||
|
||||
/// The full export options for `doc`: settings plus the artboards `p` picks (default all).
|
||||
/// The full export options for `doc`: settings plus the artboards `p` picks (default all), created
|
||||
/// at `doc`'s File Info creation date (the time of writing when it has none) and modified at the
|
||||
/// time of writing. On the web, which has no clock, the creation date is the modification date too,
|
||||
/// and a document without one gets neither.
|
||||
pub fn options(cmd: &str, doc: &Document, p: &Value) -> Result<PdfOptions> {
|
||||
let pick = if p.is_object() { ArtboardPick::deserialize(p).map_err(|e| bad(cmd, format!("PDF options: {e}")))? } else { ArtboardPick::default() };
|
||||
let artboards = pick.resolve(doc.artboards.len()).map_err(|e| bad(cmd, e))?;
|
||||
Ok(PdfOptions { settings: settings(cmd, p)?, artboards, ..Default::default() })
|
||||
let now = vectorcraft_doc::metadata::now_unix();
|
||||
Ok(PdfOptions { settings: settings(cmd, p)?, artboards, created: doc.metadata.created.or(now), modified: now, ..Default::default() })
|
||||
}
|
||||
|
||||
/// Why a PDF of some artboards carries no editing data.
|
||||
|
||||
Reference in New Issue
Block a user