diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-02 15:41:39 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-02 15:45:18 +0100 |
| commit | 9bc90c371fb41a2d6dc08eb4673e5be15f829514 (patch) | |
| tree | 454a47ce82c2229e79a139a8bdeaed9add1e0a14 /src/export/pdf/mod.rs | |
| parent | 5110a41de1ca2236739ace2d37a1af912bb029f1 (diff) | |
Introspection
Diffstat (limited to 'src/export/pdf/mod.rs')
| -rw-r--r-- | src/export/pdf/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/export/pdf/mod.rs b/src/export/pdf/mod.rs index 8f9d9637..60cd4ea2 100644 --- a/src/export/pdf/mod.rs +++ b/src/export/pdf/mod.rs @@ -14,7 +14,7 @@ use pdf_writer::{Finish, Name, PdfWriter, Ref, TextStr}; use self::outline::HeadingNode; use self::page::Page; -use crate::doc::{Document, Lang, Metadata}; +use crate::doc::{Document, Lang}; use crate::font::Font; use crate::geom::{Abs, Dir, Em}; use crate::image::Image; @@ -23,7 +23,7 @@ use crate::image::Image; /// /// Returns the raw bytes making up the PDF file. pub fn pdf(document: &Document) -> Vec<u8> { - let mut ctx = PdfContext::new(&document.metadata); + let mut ctx = PdfContext::new(document); page::construct_pages(&mut ctx, &document.pages); font::write_fonts(&mut ctx); image::write_images(&mut ctx); @@ -38,7 +38,7 @@ const D65_GRAY: Name<'static> = Name(b"d65gray"); /// Context for exporting a whole PDF document. pub struct PdfContext<'a> { - metadata: &'a Metadata, + document: &'a Document, writer: PdfWriter, pages: Vec<Page>, page_heights: Vec<f32>, @@ -55,11 +55,11 @@ pub struct PdfContext<'a> { } impl<'a> PdfContext<'a> { - fn new(metadata: &'a Metadata) -> Self { + fn new(document: &'a Document) -> Self { let mut alloc = Ref::new(1); let page_tree_ref = alloc.bump(); Self { - metadata, + document, writer: PdfWriter::new(), pages: vec![], page_heights: vec![], @@ -116,10 +116,10 @@ fn write_catalog(ctx: &mut PdfContext) { // Write the document information. let mut info = ctx.writer.document_info(ctx.alloc.bump()); - if let Some(title) = &ctx.metadata.title { + if let Some(title) = &ctx.document.title { info.title(TextStr(title)); } - if let Some(author) = &ctx.metadata.author { + if let Some(author) = &ctx.document.author { info.author(TextStr(author)); } info.creator(TextStr("Typst")); |
