Struct pdfium_render::document::PdfDocument
source · [−]pub struct PdfDocument<'a> { /* private fields */ }Expand description
An entry point to all the various object collections contained in a single PDF file. These collections include:
- PdfDocument::pages(), all the PdfPages in the document.
- PdfDocument::metadata(), all the PdfMetadata tags in the document.
- PdfDocument::form(), the PdfForm optionally embedded in the document.
- PdfDocument::bookmarks(), all the PdfBookmarks in the document.
- PdfDocument::permissions(), settings relating to security handlers and document permissions for the document.
Implementations
sourceimpl<'a> PdfDocument<'a>
impl<'a> PdfDocument<'a>
sourcepub fn version(&self) -> PdfDocumentVersion
pub fn version(&self) -> PdfDocumentVersion
Returns the file version of this PdfDocument.
sourcepub fn set_version(&mut self, version: PdfDocumentVersion)
pub fn set_version(&mut self, version: PdfDocumentVersion)
Sets the file version that will be used the next time this PdfDocument is saved using the PdfDocument::save_to_writer() function.
sourcepub fn pages(&self) -> PdfPages<'_>
pub fn pages(&self) -> PdfPages<'_>
Returns the collection of PdfPages in this PdfDocument.
sourcepub fn metadata(&self) -> PdfMetadata<'_>
pub fn metadata(&self) -> PdfMetadata<'_>
Returns the collection of PdfMetadata tags in this PdfDocument.
sourcepub fn form(&self) -> Option<&PdfForm<'_>>
pub fn form(&self) -> Option<&PdfForm<'_>>
Returns a reference to the PdfForm embedded in this PdfDocument, if any.
sourcepub fn bookmarks(&self) -> PdfBookmarks<'_>
pub fn bookmarks(&self) -> PdfBookmarks<'_>
Returns the collection of PdfBookmarks in this PdfDocument.
sourcepub fn permissions(&self) -> PdfPermissions<'_>
pub fn permissions(&self) -> PdfPermissions<'_>
Returns the collection of PdfPermissions for this PdfDocument.
sourcepub fn append(&mut self, document: &PdfDocument<'_>) -> Result<(), PdfiumError>
pub fn append(&mut self, document: &PdfDocument<'_>) -> Result<(), PdfiumError>
Copies all pages in the given PdfDocument into this PdfDocument, appending them to the end of this document’s PdfPages collection.
For finer control over which pages are imported, and where they should be inserted, use one of the PdfPages::copy_page_from_document(), PdfPages::copy_pages_from_document(), or PdfPages::copy_page_range_from_document() functions.
Calling this function is equivalent to
self.pages().copy_page_range_from_document(
document, // Source
document.pages().as_range_inclusive(), // Select all pages
self.pages().len() // Append to end of current document
);sourcepub fn save_to_writer<W: Write>(&self, writer: W) -> Result<(), PdfiumError>
pub fn save_to_writer<W: Write>(&self, writer: W) -> Result<(), PdfiumError>
Writes this PdfDocument to the given writer.
This function is not available when compiling to WASM.
Trait Implementations
sourceimpl<'a> Drop for PdfDocument<'a>
impl<'a> Drop for PdfDocument<'a>
sourcefn drop(&mut self)
fn drop(&mut self)
Closes this PdfDocument, releasing held memory and, if the document was loaded from a file, the file handle on the document.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for PdfDocument<'a>
impl<'a> !Send for PdfDocument<'a>
impl<'a> !Sync for PdfDocument<'a>
impl<'a> Unpin for PdfDocument<'a>
impl<'a> !UnwindSafe for PdfDocument<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more