pub struct Pdf {
pub alloc: Ref,
pub pdf: Pdf,
pub pages: Vec<Page>,
pub fonts: Vec<Ref>,
pub metadata: Metadata,
/* private fields */
}Fields§
§alloc: Ref§pdf: Pdf§pages: Vec<Page>§fonts: Vec<Ref>§metadata: MetadataImplementations§
Source§impl Pdf
impl Pdf
pub fn new(metadata: Metadata) -> Self
pub fn alloc(&mut self) -> Ref
pub fn add_page(&mut self, size: (f32, f32)) -> Location
Sourcepub fn add_element(&mut self, page_size: (f32, f32), element: impl Element)
pub fn add_element(&mut self, page_size: (f32, f32), element: impl Element)
Add an element to the PDF. A new page with the given size is added initially and additional pages of the same size are added when the element requests them during drawing.
Sourcepub fn add_element_with_text_pieces_cache(
&mut self,
page_size: (f32, f32),
text_pieces_cache: &TextPiecesCache,
element: impl Element,
)
pub fn add_element_with_text_pieces_cache( &mut self, page_size: (f32, f32), text_pieces_cache: &TextPiecesCache, element: impl Element, )
The same as Pdf::add_element, but with a TextPiecesCache parameter. This is useful when adding multiple elements to a PDF that share some fonts and text.
pub fn finish(self) -> Vec<u8> ⓘ
Auto Trait Implementations§
impl Freeze for Pdf
impl RefUnwindSafe for Pdf
impl Send for Pdf
impl Sync for Pdf
impl Unpin for Pdf
impl UnsafeUnpin for Pdf
impl UnwindSafe for Pdf
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreimpl<T> MaybeSendSync for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.