pub struct Document { /* private fields */ }Expand description
The top-level document builder
Implementations§
Source§impl Document
impl Document
pub fn new() -> Self
pub fn title(self, t: impl Into<String>) -> Self
pub fn subject(self, s: impl Into<String>) -> Self
pub fn keywords(self, k: impl Into<String>) -> Self
pub fn outline(self, outline: Outline) -> Self
pub fn form(self, form: AcroForm) -> Self
Sourcepub fn page<F>(self, f: F) -> Selfwhere
F: FnOnce(&mut PageBuilder),
pub fn page<F>(self, f: F) -> Selfwhere
F: FnOnce(&mut PageBuilder),
Add an A4 page
Sourcepub fn page_sized<F>(self, width: f64, height: f64, f: F) -> Selfwhere
F: FnOnce(&mut PageBuilder),
pub fn page_sized<F>(self, width: f64, height: f64, f: F) -> Selfwhere
F: FnOnce(&mut PageBuilder),
Add a custom-size page
Sourcepub fn page_with_links<F>(self, f: F, links: Vec<LinkAnnotation>) -> Selfwhere
F: FnOnce(&mut PageBuilder),
pub fn page_with_links<F>(self, f: F, links: Vec<LinkAnnotation>) -> Selfwhere
F: FnOnce(&mut PageBuilder),
Add an A4 page with hyperlink annotations
Sourcepub fn add_pages(self, builders: Vec<PageBuilder>) -> Self
pub fn add_pages(self, builders: Vec<PageBuilder>) -> Self
Add pre-built PageBuilders (from TextFlow or similar)
Sourcepub fn header(self, h: HeaderFooter) -> Self
pub fn header(self, h: HeaderFooter) -> Self
Apply a header template to every page
Apply a footer template to every page
Sourcepub fn encrypt(self, e: Encryption) -> Self
pub fn encrypt(self, e: Encryption) -> Self
Encrypt the document with a password
Sourcepub fn signature(self, s: SignatureField) -> Self
pub fn signature(self, s: SignatureField) -> Self
Add a digital signature field. Use build_signed() to get the placeholder back.
Sourcepub fn build_signed(self) -> (Vec<u8>, Vec<SignaturePlaceholder>)
pub fn build_signed(self) -> (Vec<u8>, Vec<SignaturePlaceholder>)
Build and return PDF bytes + signature placeholders.
After receiving the bytes you can call placeholder.inject(pdf, pkcs7_der)
to embed the real cryptographic signature.
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more