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(&'a self) -> PdfPages<'a>
pub fn pages(&'a self) -> PdfPages<'a>
Returns a collection of all the PdfPages in this PdfDocument.
sourcepub fn metadata(&'a self) -> PdfMetadata<'a>
pub fn metadata(&'a self) -> PdfMetadata<'a>
Returns a collection of all the PdfMetadata tags in this PdfDocument.
sourcepub fn form(&'a self) -> Option<&PdfForm<'a>>
pub fn form(&'a self) -> Option<&PdfForm<'a>>
Returns a reference to the PdfForm embedded in this PdfDocument, if any.
sourcepub fn bookmarks(&'a self) -> PdfBookmarks<'a>
pub fn bookmarks(&'a self) -> PdfBookmarks<'a>
Returns a collection of all the PdfBookmarks in this PdfDocument.
sourcepub fn permissions(&'a self) -> PdfPermissions<'a>
pub fn permissions(&'a self) -> PdfPermissions<'a>
Returns a collection of all the PdfPermissions applied to this PdfDocument.
sourcepub fn save_to_writer<W: Write + 'static>(
&self,
writer: &mut W
) -> Result<(), PdfiumError>
pub fn save_to_writer<W: Write + 'static>(
&self,
writer: &mut W
) -> Result<(), PdfiumError>
Writes this PdfDocument to the given writer.
sourcepub fn save_to_file(
&self,
path: &impl AsRef<Path> + ?Sized
) -> Result<(), PdfiumError>
pub fn save_to_file(
&self,
path: &impl AsRef<Path> + ?Sized
) -> Result<(), PdfiumError>
Writes this PdfDocument to the file at the given path.
This function is not available when compiling to WASM.
sourcepub fn save_to_bytes(&self) -> Result<Vec<u8>, PdfiumError>
pub fn save_to_bytes(&self) -> Result<Vec<u8>, PdfiumError>
Writes this PdfDocument to a new byte buffer, returning the byte buffer.
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