pub struct PdfDocument { /* private fields */ }Expand description
A PDF of one or more drawings, one per page; each page takes its drawing’s size in PDF points (1/72 inch, the same unit as canvas points: US Letter is 612 × 792, A4 595 × 842).
ⓘ
let mut doc = PdfDocument::new().title("Quarterly report");
for region in ®ions {
doc = doc.page(Drawing::record(LETTER, |d, size| draw_region(d, size, region)));
}
let pdf = doc.render().await?;Implementations§
Source§impl PdfDocument
impl PdfDocument
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty document; rendering it before adding a page answers ExportError::Invalid.
Sourcepub fn page(self, drawing: Drawing) -> Self
pub fn page(self, drawing: Drawing) -> Self
Append drawing as the next page, at the drawing’s size.
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
The document title. Android’s writer has no metadata API and ignores it.
The document author. Android’s writer ignores it, as it does the title.
Trait Implementations§
Source§impl Clone for PdfDocument
impl Clone for PdfDocument
Source§fn clone(&self) -> PdfDocument
fn clone(&self) -> PdfDocument
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PdfDocument
impl Debug for PdfDocument
Source§impl Default for PdfDocument
impl Default for PdfDocument
Source§fn default() -> PdfDocument
fn default() -> PdfDocument
Returns the “default value” for a type. Read more
Source§impl PartialEq for PdfDocument
impl PartialEq for PdfDocument
impl StructuralPartialEq for PdfDocument
Auto Trait Implementations§
impl Freeze for PdfDocument
impl RefUnwindSafe for PdfDocument
impl Send for PdfDocument
impl Sync for PdfDocument
impl Unpin for PdfDocument
impl UnsafeUnpin for PdfDocument
impl UnwindSafe for PdfDocument
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more