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::attachments(), an immutable collection of all the PdfAttachments in the document.
- PdfDocument::attachments_mut(), a mutable collection of all the PdfAttachments in the document.
- PdfDocument::bookmarks(), an immutable collection of all the PdfBookmarks in the document.
- PdfDocument::fonts(), an immutable collection of all the PdfFonts in the document.
- PdfDocument::fonts_mut(), a mutable collection of all the PdfFonts in the document.
- PdfDocument::form(), an immutable reference to the PdfForm embedded in the document, if any.
- PdfDocument::metadata(), an immutable collection of all the PdfMetadata tags in the document.
- PdfDocument::pages(), an immutable collection of all the PdfPages in the document.
- PdfDocument::pages_mut(), a mutable collection of all the PdfPages in the document.
- PdfDocument::permissions(), settings relating to security handlers and document permissions for the document.
- PdfDocument::signatures(), an immutable collection of all the PdfSignatures in the document.
Implementations§
source§impl<'a> PdfDocument<'a>
impl<'a> PdfDocument<'a>
sourcepub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings
pub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings
Returns the PdfiumLibraryBindings used by this PdfDocument.
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.
sourcepub fn attachments(&self) -> &PdfAttachments<'_>
pub fn attachments(&self) -> &PdfAttachments<'_>
Returns an immutable collection of all the PdfAttachments embedded in this PdfDocument.
sourcepub fn attachments_mut(&mut self) -> &mut PdfAttachments<'a>
pub fn attachments_mut(&mut self) -> &mut PdfAttachments<'a>
Returns a mutable collection of all the PdfAttachments embedded in this PdfDocument.
sourcepub fn bookmarks(&self) -> &PdfBookmarks<'_>
pub fn bookmarks(&self) -> &PdfBookmarks<'_>
Returns an immutable collection of all the PdfBookmarks in this PdfDocument.
sourcepub fn form(&self) -> Option<&PdfForm<'_>>
pub fn form(&self) -> Option<&PdfForm<'_>>
Returns an immutable reference to the PdfForm embedded in this PdfDocument, if any.
sourcepub fn fonts(&self) -> &PdfFonts<'_>
pub fn fonts(&self) -> &PdfFonts<'_>
Returns an immutable collection of all the PdfFonts in this PdfDocument.
sourcepub fn fonts_mut(&mut self) -> &mut PdfFonts<'a>
pub fn fonts_mut(&mut self) -> &mut PdfFonts<'a>
Returns a mutable collection of all the PdfFonts in this PdfDocument.
sourcepub fn metadata(&self) -> &PdfMetadata<'_>
pub fn metadata(&self) -> &PdfMetadata<'_>
Returns an immutable collection of all the PdfMetadata tags in this PdfDocument.
sourcepub fn pages(&self) -> &PdfPages<'a>
pub fn pages(&self) -> &PdfPages<'a>
Returns an immutable collection of all the PdfPages in this PdfDocument.
sourcepub fn pages_mut(&mut self) -> &mut PdfPages<'a>
pub fn pages_mut(&mut self) -> &mut PdfPages<'a>
Returns a mutable collection of all the PdfPages in this PdfDocument.
sourcepub fn permissions(&self) -> &PdfPermissions<'_>
pub fn permissions(&self) -> &PdfPermissions<'_>
Returns an immutable collection of all the PdfPermissions applied to this PdfDocument.
sourcepub fn signatures(&self) -> &PdfSignatures<'_>
pub fn signatures(&self) -> &PdfSignatures<'_>
Returns an immutable collection of all the PdfSignatures attached 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. You have several options for saving your PDF document data in WASM:
- Use either the PdfDocument::save_to_writer() or the PdfDocument::save_to_bytes() functions, both of which are available when compiling to WASM.
- Use the PdfDocument::save_to_blob() function to save document data directly into a new
Javascript
Blob
object. This function is only 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.
sourcepub fn save_to_blob(&self) -> Result<Blob, PdfiumError>
pub fn save_to_blob(&self) -> Result<Blob, PdfiumError>
Writes this PdfDocument to a new Blob
, returning the Blob
.
This function is only available when compiling to WASM.
Trait Implementations§
source§impl<'a> Debug for PdfDocument<'a>
impl<'a> Debug for PdfDocument<'a>
source§impl<'a> Drop for PdfDocument<'a>
impl<'a> Drop for PdfDocument<'a>
source§fn 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.