pub struct PdfDocument {
pub inner: PDDocument,
}Expand description
Context-oriented facade for intuitive, modern PDF processing.
Fields§
§inner: PDDocumentImplementations§
Source§impl PdfDocument
impl PdfDocument
Sourcepub fn open_from_bytes(bytes: &[u8]) -> PdfResult<Self>
pub fn open_from_bytes(bytes: &[u8]) -> PdfResult<Self>
Opens a PDF document from in-memory bytes.
Sourcepub fn add_blank_page(&mut self, size: PDRectangle) -> usize
pub fn add_blank_page(&mut self, size: PDRectangle) -> usize
Adds a blank page with the specified dimensions (e.g. PDRectangle::A4).
Sourcepub fn page_count(&self) -> usize
pub fn page_count(&self) -> usize
Returns the total number of pages.
Sourcepub fn set_title(&mut self, title: impl Into<String>) -> &mut Self
pub fn set_title(&mut self, title: impl Into<String>) -> &mut Self
Sets the document title in metadata.
Sets the document author in metadata.
Sourcepub fn draw_on_page<F>(
&mut self,
page_index: usize,
mode: AppendMode,
f: F,
) -> PdfResult<()>
pub fn draw_on_page<F>( &mut self, page_index: usize, mode: AppendMode, f: F, ) -> PdfResult<()>
Draws onto a page using a closure that receives a PDPageContentStream.
Sourcepub fn stamp(&self) -> Stamper
pub fn stamp(&self) -> Stamper
Returns a fluent Stamper for watermarking, headers/footers, and rubber stamps.
Sourcepub fn watermark(&mut self, text: impl Into<String>) -> PdfResult<()>
pub fn watermark(&mut self, text: impl Into<String>) -> PdfResult<()>
Applies a simple diagonal text watermark across all pages.
Sourcepub fn sign(&mut self, signer: Signer) -> PdfResult<Vec<u8>>
pub fn sign(&mut self, signer: Signer) -> PdfResult<Vec<u8>>
Digitally signs the document using the given Signer and returns signed PDF bytes.
Sourcepub fn extract_text(&self) -> PdfResult<String>
pub fn extract_text(&self) -> PdfResult<String>
Extracts all text from the document.
Sourcepub fn merge(&mut self, other: &PdfDocument) -> PdfResult<()>
pub fn merge(&mut self, other: &PdfDocument) -> PdfResult<()>
Merges another document into this document.
Sourcepub fn split_single_pages(&self) -> PdfResult<Vec<PdfDocument>>
pub fn split_single_pages(&self) -> PdfResult<Vec<PdfDocument>>
Splits this document into individual 1-page documents.
Sourcepub fn flatten_forms(&mut self) -> PdfResult<()>
pub fn flatten_forms(&mut self) -> PdfResult<()>
Flattens all interactive form fields into static page contents.