diff options
| author | Laurenz Stampfl <47084093+LaurenzV@users.noreply.github.com> | 2023-09-26 10:47:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-26 10:47:25 +0200 |
| commit | c55901e972f6671ecfe05358a96f85f34c703cc0 (patch) | |
| tree | 1134091a3f0832e3d7d9b552c685089711bd0c75 /crates | |
| parent | e33017042da6b0a202894fd401e0b99fdc8494e5 (diff) | |
Embed the current Typst version in the PDF (#2236)
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/typst/src/export/pdf/mod.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/typst/src/export/pdf/mod.rs b/crates/typst/src/export/pdf/mod.rs index 4043c928..3d0b9135 100644 --- a/crates/typst/src/export/pdf/mod.rs +++ b/crates/typst/src/export/pdf/mod.rs @@ -15,7 +15,7 @@ use std::collections::{BTreeMap, HashMap}; use std::hash::Hash; use std::num::NonZeroUsize; -use ecow::EcoString; +use ecow::{eco_format, EcoString}; use pdf_writer::types::Direction; use pdf_writer::writers::PageLabel; use pdf_writer::{Finish, Name, PdfWriter, Ref, TextStr}; @@ -133,6 +133,10 @@ fn write_catalog(ctx: &mut PdfContext) { xmp.creator(authors.iter().map(|s| s.as_str())); } + let creator = eco_format!("Typst {}", env!("CARGO_PKG_VERSION")); + info.creator(TextStr(&creator)); + xmp.creator_tool(&creator); + let keywords = &ctx.document.keywords; if !keywords.is_empty() { let joined = keywords.join(", "); @@ -140,9 +144,7 @@ fn write_catalog(ctx: &mut PdfContext) { xmp.pdf_keywords(&joined); } - info.creator(TextStr("Typst")); info.finish(); - xmp.creator_tool("Typst"); xmp.num_pages(ctx.document.pages.len() as u32); xmp.format("application/pdf"); xmp.language(ctx.languages.keys().map(|lang| LangId(lang.as_str()))); |
