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

A single page in a PdfDocument.

In addition to its own intrinsic properties, a PdfPage serves as the entry point to all object collections related to a single page in a document. These collections include:

Implementations

Returns the PdfDocument containing this PdfPage.

Returns the PdfiumLibraryBindings used by the PdfDocument containing this PdfPage.

Returns the label assigned to this PdfPage, if any.

Returns the width of this PdfPage in device-independent points. One point is 1/72 inches, roughly 0.358 mm.

Returns the height of this PdfPage in device-independent points. One point is 1/72 inches, roughly 0.358 mm.

Returns the width and height of this PdfPage expressed as a PdfRect.

Returns PdfPageOrientation::Landscape if the width of this PdfPage is greater than its height; otherwise returns PdfPageOrientation::Portrait.

Returns true if this PdfPage has orientation PdfPageOrientation::Portrait.

Returns true if this PdfPage has orientation PdfPageOrientation::Landscape.

Returns any intrinsic rotation encoded into this document indicating a rotation should be applied to this PdfPage during rendering.

Sets the intrinsic rotation that should be applied to this PdfPage during rendering.

Returns true if any object on the page contains transparency.

Returns the paper size of this PdfPage.

Returns true if this PdfPage contains an embedded thumbnail.

Embedded thumbnails can be generated as a courtesy by PDF generators to save PDF consumers the burden of having to render their own thumbnails on the fly. If a thumbnail for this page was not embedded at the time the document was created, one can easily be rendered using the standard rendering functions:

    let thumbnail_desired_pixel_size = 128;

    let thumbnail = page.render_with_config(
        &PdfRenderConfig::thumbnail(thumbnail_desired_pixel_size)
    )?; // Renders a 128 x 128 thumbnail of the page

Returns the embedded thumbnail for this PdfPage, if any.

Embedded thumbnails can be generated as a courtesy by PDF generators to save PDF consumers the burden of having to render their own thumbnails on the fly. If a thumbnail for this page was not embedded at the time the document was created, one can easily be rendered using the standard rendering functions:

    let thumbnail_desired_pixel_size = 128;

    let thumbnail = page.render_with_config(
        &PdfRenderConfig::thumbnail(thumbnail_desired_pixel_size)
    )?; // Renders a 128 x 128 thumbnail of the page

Returns the collection of text boxes contained within this PdfPage.

Returns an immutable collection of the annotations that have been added to this PdfPage.

Returns a mutable collection of the annotations that have been added to this PdfPage.

Returns an immutable collection of the bounding boxes defining the extents of this PdfPage.

Returns a mutable collection of the bounding boxes defining the extents of this PdfPage.

Returns an immutable collection of all the page objects on this PdfPage.

Returns a mutable collection of all the page objects on this PdfPage.

Renders this PdfPage into a PdfBitmap with the given pixel dimensions and page rotation.

It is the responsibility of the caller to ensure the given pixel width and height correctly maintain the page’s aspect ratio.

See also PdfPage::render_with_config(), which calculates the correct pixel dimensions, rotation settings, and rendering options to apply from a PdfRenderConfig object.

Each call to PdfPage::render() creates a new PdfBitmap object and allocates memory for it. To avoid repeated allocations, create a single PdfBitmap object using PdfBitmap::empty() and reuse it across multiple calls to PdfPage::render_into_bitmap().

Renders this PdfPage into a new PdfBitmap using pixel dimensions, page rotation settings, and rendering options configured in the given PdfRenderConfig.

Each call to PdfPage::render_with_config() creates a new PdfBitmap object and allocates memory for it. To avoid repeated allocations, create a single PdfBitmap object using PdfBitmap::empty() and reuse it across multiple calls to PdfPage::render_into_bitmap_with_config().

Renders this PdfPage into the given PdfBitmap using the given the given pixel dimensions and page rotation.

It is the responsibility of the caller to ensure the given pixel width and height correctly maintain the page’s aspect ratio. The size of the buffer backing the given bitmap must be sufficiently large to hold the rendered image or an error will be returned.

See also PdfPage::render_into_bitmap_with_config(), which calculates the correct pixel dimensions, rotation settings, and rendering options to apply from a PdfRenderConfig object.

Renders this PdfPage into the given PdfBitmap using pixel dimensions, page rotation settings, and rendering options configured in the given PdfRenderConfig.

The size of the buffer backing the given bitmap must be sufficiently large to hold the rendered image or an error will be returned.

Flattens all annotations and form fields on this PdfPage into the page contents.

Returns the strategy used by pdfium-render to regenerate the content of a PdfPage.

Updates to a PdfPage are not committed to the underlying PdfDocument until the page’s content is regenerated. If a page is reloaded or closed without regenerating the page’s content, any changes not applied are lost.

By default, pdfium-render will trigger content regeneration on any change to a PdfPage; this removes the possibility of data loss, and ensures changes can be read back from other data structures as soon as they are made. However, if many changes are made to a page at once, then regenerating the content after every change is inefficient; it is faster to stage all changes first, then regenerate the page’s content just once. In this case, changing the content regeneration strategy for a PdfPage can improve performance, but you must be careful not to forget to commit your changes before closing or reloading the page.

Sets the strategy used by pdfium-render to regenerate the content of a PdfPage.

Updates to a PdfPage are not committed to the underlying PdfDocument until the page’s content is regenerated. If a page is reloaded or closed without regenerating the page’s content, any changes not applied are lost.

By default, pdfium-render will trigger content regeneration on any change to a PdfPage; this removes the possibility of data loss, and ensures changes can be read back from other data structures as soon as they are made. However, if many changes are made to a page at once, then regenerating the content after every change is inefficient; it is faster to stage all changes first, then regenerate the page’s content just once. In this case, changing the content regeneration strategy for a PdfPage can improve performance, but you must be careful not to forget to commit your changes before closing or reloading the page.

Commits any staged but unsaved changes to this PdfPage to the underlying PdfDocument.

Updates to a PdfPage are not committed to the underlying PdfDocument until the page’s content is regenerated. If a page is reloaded or closed without regenerating the page’s content, any changes not applied are lost.

By default, pdfium-render will trigger content regeneration on any change to a PdfPage; this removes the possibility of data loss, and ensures changes can be read back from other data structures as soon as they are made. However, if many changes are made to a page at once, then regenerating the content after every change is inefficient; it is faster to stage all changes first, then regenerate the page’s content just once. In this case, changing the content regeneration strategy for a PdfPage can improve performance, but you must be careful not to forget to commit your changes before closing or reloading the page.

Trait Implementations

Closes this PdfPage, releasing held memory.

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.