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 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