pub struct PdfDoc { /* private fields */ }Expand description
A high-level PDF document.
This wraps CosDoc and provides PDF-specific operations like
page management, metadata access, and save.
Implementations§
Source§impl PdfDoc
impl PdfDoc
Sourcepub fn open_from_bytes(data: Vec<u8>) -> Result<Self>
pub fn open_from_bytes(data: Vec<u8>) -> Result<Self>
Open a PDF document from bytes.
Sourcepub fn page_count(&mut self) -> Result<u32>
pub fn page_count(&mut self) -> Result<u32>
Get the number of pages in the document.
Sourcepub fn create_page(&mut self, media_box: Rect) -> Result<u32>
pub fn create_page(&mut self, media_box: Rect) -> Result<u32>
Create a new page with the given media box and add it to the document.
Sourcepub fn is_modified(&self) -> bool
pub fn is_modified(&self) -> bool
Check if the document has been modified.
Sourcepub fn save_to_bytes(&mut self) -> Result<Vec<u8>>
pub fn save_to_bytes(&mut self) -> Result<Vec<u8>>
Save the document to bytes.
Auto Trait Implementations§
impl Freeze for PdfDoc
impl RefUnwindSafe for PdfDoc
impl Send for PdfDoc
impl Sync for PdfDoc
impl Unpin for PdfDoc
impl UnsafeUnpin for PdfDoc
impl UnwindSafe for PdfDoc
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
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