Struct pdfium_render::attachment::PdfAttachment
source · [−]pub struct PdfAttachment<'a> { /* private fields */ }Expand description
A single attached data file embedded in a PdfDocument.
Implementations
sourceimpl<'a> PdfAttachment<'a>
impl<'a> PdfAttachment<'a>
sourcepub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings
pub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings
Returns the PdfiumLibraryBindings used by this PdfAttachment.
sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Returns the name of this PdfAttachment.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the size of this PdfAttachment in bytes.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if there is no byte data associated with this PdfAttachment.
sourcepub fn save_to_bytes(&self) -> Result<Vec<u8>, PdfiumError>
pub fn save_to_bytes(&self) -> Result<Vec<u8>, PdfiumError>
Writes this PdfAttachment to a new byte buffer, returning the byte buffer.
sourcepub fn save_to_writer<W: Write>(&self, writer: &mut W) -> Result<(), PdfiumError>
pub fn save_to_writer<W: Write>(&self, writer: &mut W) -> Result<(), PdfiumError>
Writes this PdfAttachment 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 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:
- Use either the PdfAttachment::save_to_writer() or the PdfAttachment::save_to_bytes() functions, both of which are available when compiling to WASM.
- Use the
PdfAttachment::save_to_blob()function to save attachment data directly into a new Javascript Blob object. This function is only available when compiling to WASM.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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