Struct rckive_genpdf::render::Renderer
source · pub struct Renderer { /* private fields */ }
Expand description
Renders a PDF document with one or more pages.
This is a wrapper around a printpdf::PdfDocumentReference
.
Implementations§
source§impl Renderer
impl Renderer
sourcepub fn new(
size: impl Into<Size>,
title: impl AsRef<str>
) -> Result<Renderer, Error>
pub fn new(
size: impl Into<Size>,
title: impl AsRef<str>
) -> Result<Renderer, Error>
Creates a new PDF document renderer with one page of the given size and the given title.
sourcepub fn with_conformance(self, conformance: PdfConformance) -> Self
pub fn with_conformance(self, conformance: PdfConformance) -> Self
Sets the PDF conformance for the generated PDF document.
sourcepub fn with_creation_date(self, date: OffsetDateTime) -> Self
pub fn with_creation_date(self, date: OffsetDateTime) -> Self
Sets the creation date for the generated PDF document.
sourcepub fn with_modification_date(self, date: OffsetDateTime) -> Self
pub fn with_modification_date(self, date: OffsetDateTime) -> Self
Sets the modification date for the generated PDF document.
sourcepub fn add_page(&mut self, size: impl Into<Size>)
pub fn add_page(&mut self, size: impl Into<Size>)
Adds a new page with the given size to the document.
sourcepub fn page_count(&self) -> usize
pub fn page_count(&self) -> usize
Returns the number of pages in this document.
sourcepub fn get_page_mut(&mut self, idx: usize) -> Option<&mut Page>
pub fn get_page_mut(&mut self, idx: usize) -> Option<&mut Page>
Returns a mutable reference to a page of this document.
sourcepub fn first_page(&self) -> &Page
pub fn first_page(&self) -> &Page
Returns a mutable reference to the first page of this document.
sourcepub fn first_page_mut(&mut self) -> &mut Page
pub fn first_page_mut(&mut self) -> &mut Page
Returns the first page of this document.
sourcepub fn last_page_mut(&mut self) -> &mut Page
pub fn last_page_mut(&mut self) -> &mut Page
Returns a mutable reference to the last page of this document.
sourcepub fn add_builtin_font(
&self,
builtin: BuiltinFont
) -> Result<IndirectFontRef, Error>
pub fn add_builtin_font(
&self,
builtin: BuiltinFont
) -> Result<IndirectFontRef, Error>
Loads the font from the given data, adds it to the generated document and returns a reference to it.
sourcepub fn add_embedded_font(&self, data: &[u8]) -> Result<IndirectFontRef, Error>
pub fn add_embedded_font(&self, data: &[u8]) -> Result<IndirectFontRef, Error>
Loads the font from the given data, adds it to the generated document and returns a reference to it.