Struct printpdf::types::pdf_document::PdfDocumentReference
source · pub struct PdfDocumentReference { /* private fields */ }
Expand description
Marker struct for a document. Used to make the API a bit nicer.
It simply calls PdfDocument
functions.
Implementations§
source§impl PdfDocumentReference
impl PdfDocumentReference
sourcepub fn with_title<S>(self, new_title: S)where
S: Into<String>,
pub fn with_title<S>(self, new_title: S)where
S: Into<String>,
Changes the title on both the document info dictionary as well as the metadata
sourcepub fn with_trapping(self, trapping: bool) -> Self
pub fn with_trapping(self, trapping: bool) -> Self
Set the trapping of the document
sourcepub fn with_document_id(self, id: String) -> Self
pub fn with_document_id(self, id: String) -> Self
Sets the document ID (for comparing two PDF documents for equality)
sourcepub fn with_document_version(self, version: u32) -> Self
pub fn with_document_version(self, version: u32) -> Self
Set the version of the document
sourcepub fn with_conformance(self, conformance: PdfConformance) -> Self
pub fn with_conformance(self, conformance: PdfConformance) -> Self
Changes the conformance of this document. It is recommended to call
check_for_errors()
after changing it.
sourcepub fn with_mod_date(self, mod_date: Tm) -> Self
pub fn with_mod_date(self, mod_date: Tm) -> Self
Sets the modification date on the document. Intended to be used when reading documents that already have a modification date.
sourcepub fn add_page<S>(
&self,
x_mm: Mm,
y_mm: Mm,
inital_layer_name: S
) -> (PdfPageIndex, PdfLayerIndex)where
S: Into<String>,
pub fn add_page<S>(
&self,
x_mm: Mm,
y_mm: Mm,
inital_layer_name: S
) -> (PdfPageIndex, PdfLayerIndex)where
S: Into<String>,
Create a new pdf page and returns the index of the page
sourcepub fn add_external_font<R>(
&self,
font_stream: R
) -> Result<IndirectFontRef, Error>where
R: Read,
pub fn add_external_font<R>(
&self,
font_stream: R
) -> Result<IndirectFontRef, Error>where
R: Read,
Add a font from a font stream
sourcepub fn add_builtin_font(
&self,
builtin_font: BuiltinFont
) -> Result<IndirectFontRef, Error>
pub fn add_builtin_font(
&self,
builtin_font: BuiltinFont
) -> Result<IndirectFontRef, Error>
Add a built-in font to the document
sourcepub fn get_page(&self, page: PdfPageIndex) -> PdfPageReference
pub fn get_page(&self, page: PdfPageIndex) -> PdfPageReference
Returns the page (for inserting content)
sourcepub fn get_font(&self, font: &IndirectFontRef) -> Option<DirectFontRef>
pub fn get_font(&self, font: &IndirectFontRef) -> Option<DirectFontRef>
Returns a direct reference (object ID) to the font from an indirect reference (postscript name)
sourcepub unsafe fn get_inner(self) -> Document
pub unsafe fn get_inner(self) -> Document
Drops the PDFDocument, returning the inner lopdf::Document
.
Document may be only half-written, use only in extreme cases
sourcepub fn check_for_errors(&self) -> Result<(), Error>
pub fn check_for_errors(&self) -> Result<(), Error>
Checks for invalid settings in the document
sourcepub fn repair_errors(&self, _conformance: PdfConformance) -> Result<(), Error>
pub fn repair_errors(&self, _conformance: PdfConformance) -> Result<(), Error>
Tries to match the document to the given conformance. Errors only on an unrecoverable error.