diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-15 23:22:00 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-15 23:22:00 +0100 |
| commit | 310c229c610654b6370157b605086a9daa977a96 (patch) | |
| tree | e9bf42c56f300d2e83081582f91f5273096b63b4 /src | |
| parent | 942fa6636d34a70dcd3d1dfe91a81ea6893f481e (diff) | |
Changelog
Diffstat (limited to 'src')
| -rw-r--r-- | src/export/pdf/mod.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/export/pdf/mod.rs b/src/export/pdf/mod.rs index 38433211..69fa805b 100644 --- a/src/export/pdf/mod.rs +++ b/src/export/pdf/mod.rs @@ -116,10 +116,8 @@ fn write_catalog(ctx: &mut PdfContext) { }; // Write the document information. - let meta_ref = ctx.alloc.bump(); - let mut xmp = XmpWriter::new(); - let mut info = ctx.writer.document_info(ctx.alloc.bump()); + let mut xmp = XmpWriter::new(); if let Some(title) = &ctx.document.title { info.title(TextStr(title)); xmp.title([(None, title.as_str())]); @@ -129,6 +127,7 @@ fn write_catalog(ctx: &mut PdfContext) { xmp.creator([(author.as_str())]); } info.creator(TextStr("Typst")); + info.finish(); xmp.creator_tool("Typst"); xmp.num_pages(ctx.document.pages.len() as u32); xmp.format("application/pdf"); @@ -136,10 +135,9 @@ fn write_catalog(ctx: &mut PdfContext) { xmp.rendition_class(RenditionClass::Proof); xmp.pdf_version("1.7"); - info.finish(); - let xmp_buf = xmp.finish(None); - let mut meta_stream = ctx.writer.stream(meta_ref, &xmp_buf); + let meta_ref = ctx.alloc.bump(); + let mut meta_stream = ctx.writer.stream(meta_ref, xmp_buf.as_bytes()); meta_stream.pair(Name(b"Type"), Name(b"Metadata")); meta_stream.pair(Name(b"Subtype"), Name(b"XML")); meta_stream.finish(); |
