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

The collection of PdfAttachment objects embedded in a PdfDocument.

Implementations

Returns the PdfiumLibraryBindings used by this PdfAttachments collection.

Returns the number of attachments in this PdfAttachments collection.

Returns true if this PdfAttachments collection is empty.

Returns a Range from 0..(number of attachments) for this PdfAttachments collection.

Returns an inclusive Range from 0..=(number of attachments - 1) for this PdfAttachments collection.

Returns a single PdfAttachment from this PdfAttachments collection.

Attempts to add a new PdfAttachment to this collection, using the given name and the data in the given byte buffer. An error will be returned if the given name is not unique in the list of attachments already present in the containing PDF document.

Attempts to add a new PdfAttachment to this collection, using the given name and file path. Byte data from the given file path will be embedded directly into the containing document. An error will be returned if the given name is not unique in the list of attachments already present in the containing PDF document.

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

  • Use the PdfAttachments::create_attachment_from_fetch() function to download attachment data from a URL using the browser’s built-in fetch() API. This function is only available when compiling to WASM.
  • Use the PdfAttachments::create_attachment_from_blob() function to load attachment data from a Javascript File or Blob object (such as a File object returned from an HTML <input type="file"> element). This function is only available when compiling to WASM.
  • Use another method to retrieve the bytes of the target attachment over the network, then load those bytes into Pdfium using the PdfAttachments::create_attachment_from_bytes() function.
  • Embed the bytes of the target attachment directly into the compiled WASM module using the include_bytes!() macro.

Attempts to add a new PdfAttachment to this collection, using the given name and the given reader. Byte data from the given reader will be embedded directly into the containing document. An error will be returned if the given name is not unique in the list of attachments already present in the containing PDF document.

Deletes the attachment at the given index from this PdfAttachments collection.

Pdfium’s current implementation of this action does not remove the attachment data from the document; it simply removes the attachment’s index entry from the document, so that the attachment no longer appears in the list of attachments. This behavior may change in the future.

Returns an iterator over all the attachments in this PdfAttachments collection.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.