pub struct PdfDocument { /* private fields */ }Expand description
A high-level representation of a PDF document.
This is the main entry point for creating and modifying PDF documents.
Implementations§
Source§impl PdfDocument
impl PdfDocument
Sourcepub fn load_with_options(bytes: &[u8], options: LoadOptions) -> Result<Self>
pub fn load_with_options(bytes: &[u8], options: LoadOptions) -> Result<Self>
Load an existing PDF document from bytes with options.
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Returns true if the document is encrypted.
Sourcepub fn get_page_count(&self) -> usize
pub fn get_page_count(&self) -> usize
Get the number of pages in the document.
Sourcepub fn get_page_indices(&self) -> Vec<usize>
pub fn get_page_indices(&self) -> Vec<usize>
Get the page indices (0-based).
Sourcepub fn add_page(&mut self, size: [f64; 2]) -> PdfRef
pub fn add_page(&mut self, size: [f64; 2]) -> PdfRef
Add a new blank page to the end of the document with the given size.
Sourcepub fn insert_page(&mut self, index: usize, size: [f64; 2]) -> PdfRef
pub fn insert_page(&mut self, index: usize, size: [f64; 2]) -> PdfRef
Insert a new blank page at the given index.
Sourcepub fn remove_page(&mut self, index: usize)
pub fn remove_page(&mut self, index: usize)
Remove a page at the given index.
Sourcepub fn copy_pages(
&mut self,
src_doc: &PdfDocument,
indices: &[usize],
) -> Vec<PdfRef>
pub fn copy_pages( &mut self, src_doc: &PdfDocument, indices: &[usize], ) -> Vec<PdfRef>
Copy pages from another document. Returns the new page refs.
Set the document author.
Sourcepub fn set_subject(&mut self, subject: &str)
pub fn set_subject(&mut self, subject: &str)
Set the document subject.
Sourcepub fn set_keywords(&mut self, keywords: &[&str])
pub fn set_keywords(&mut self, keywords: &[&str])
Set the document keywords.
Sourcepub fn set_creator(&mut self, creator: &str)
pub fn set_creator(&mut self, creator: &str)
Set the document creator.
Sourcepub fn set_producer(&mut self, producer: &str)
pub fn set_producer(&mut self, producer: &str)
Set the document producer.
Get the document author, if any.
Sourcepub fn context(&self) -> &PdfContext
pub fn context(&self) -> &PdfContext
Get direct access to the context (for advanced use).
Sourcepub fn context_mut(&mut self) -> &mut PdfContext
pub fn context_mut(&mut self) -> &mut PdfContext
Get mutable access to the context.
Sourcepub fn get_page_refs(&self) -> Vec<PdfRef>
pub fn get_page_refs(&self) -> Vec<PdfRef>
Get the refs for each page (public for inspection).