PdfAttachment

Struct PdfAttachment 

Source
pub struct PdfAttachment<'a> { /* private fields */ }
Expand description

A single attached data file embedded in a PdfDocument.

Implementations§

Source§

impl<'a> PdfAttachment<'a>

Source

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

Returns the PdfiumLibraryBindings used by this PdfAttachment.

Source

pub fn name(&self) -> String

Returns the name of this PdfAttachment.

Source

pub fn len(&self) -> usize

Returns the size of this PdfAttachment in bytes.

Source

pub fn is_empty(&self) -> bool

Returns true if there is no byte data associated with this PdfAttachment.

Source

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

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

Source

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

Writes this PdfAttachment to the given writer.

Source

pub fn save_to_file( &self, path: &(impl AsRef<Path> + ?Sized), ) -> Result<(), PdfiumError>

Writes this PdfAttachment to the file at the given path.

This function is not available when compiling to WASM. You have several options for saving attachment data in WASM:

Source

pub fn save_to_blob(&self) -> Result<Blob, PdfiumError>

Writes this PdfAttachment to a new Blob, returning the Blob.

This function is only available when compiling to WASM.

Auto Trait Implementations§

§

impl<'a> Freeze for PdfAttachment<'a>

§

impl<'a> !RefUnwindSafe for PdfAttachment<'a>

§

impl<'a> !Send for PdfAttachment<'a>

§

impl<'a> !Sync for PdfAttachment<'a>

§

impl<'a> Unpin for PdfAttachment<'a>

§

impl<'a> !UnwindSafe for PdfAttachment<'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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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

Source§

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.