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:

Implementations§

source§

impl<'a> PdfDocument<'a>

source

pub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings

Returns the PdfiumLibraryBindings used by this PdfDocument.

source

pub fn version(&self) -> PdfDocumentVersion

Returns the file version of this PdfDocument.

source

pub fn set_version(&mut self, version: PdfDocumentVersion)

Sets the file version that will be used the next time this PdfDocument is saved.

source

pub fn attachments(&self) -> &PdfAttachments<'_>

Returns an immutable collection of all the PdfAttachments embedded in this PdfDocument.

source

pub fn attachments_mut(&mut self) -> &mut PdfAttachments<'a>

Returns a mutable collection of all the PdfAttachments embedded in this PdfDocument.

source

pub fn bookmarks(&self) -> &PdfBookmarks<'_>

Returns an immutable collection of all the PdfBookmarks in this PdfDocument.

source

pub fn form(&self) -> Option<&PdfForm<'_>>

Returns an immutable reference to the PdfForm embedded in this PdfDocument, if any.

source

pub fn fonts(&self) -> &PdfFonts<'_>

Returns an immutable collection of all the PdfFonts in this PdfDocument.

source

pub fn fonts_mut(&mut self) -> &mut PdfFonts<'a>

Returns a mutable collection of all the PdfFonts in this PdfDocument.

source

pub fn metadata(&self) -> &PdfMetadata<'_>

Returns an immutable collection of all the PdfMetadata tags in this PdfDocument.

source

pub fn pages(&self) -> &PdfPages<'a>

Returns an immutable collection of all the PdfPages in this PdfDocument.

source

pub fn pages_mut(&mut self) -> &mut PdfPages<'a>

Returns a mutable collection of all the PdfPages in this PdfDocument.

source

pub fn permissions(&self) -> &PdfPermissions<'_>

Returns an immutable collection of all the PdfPermissions applied to this PdfDocument.

source

pub fn signatures(&self) -> &PdfSignatures<'_>

Returns an immutable collection of all the PdfSignatures attached to this PdfDocument.

source

pub fn save_to_writer<W: Write + 'static>( &self, writer: &mut W ) -> Result<(), PdfiumError>

Writes this PdfDocument to the given writer.

source

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:

source

pub fn save_to_bytes(&self) -> Result<Vec<u8>, PdfiumError>

Writes this PdfDocument to a new byte buffer, returning the byte buffer.

source

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>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Drop for PdfDocument<'a>

source§

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.