Struct pdfium_render::bitmap_config::PdfBitmapConfig
source · [−]pub struct PdfBitmapConfig { /* private fields */ }Expand description
Configures the scaling and rotation settings that should be applied to a PdfPage to create a PdfBitmap for that page. PdfBitmapConfig can accommodate pages of different sizes while correctly maintaining each page’s aspect ratio, automatically rotate portrait or landscape pages, generate page thumbnails, and apply maximum and minimum pixel sizes to the scaled width and height of the final bitmap.
Implementations
Converts the width and height of a PdfPage from points to pixels, scaling each dimension to the given target pixel sizes. The aspect ratio of the source page will not be maintained.
Converts the width of a PdfPage from points to pixels, scaling the source page width to the given target pixel width. The aspect ratio of the source page will be maintained so long as there is no call to PdfBitmapConfig::set_target_size() or PdfBitmapConfig::set_target_height() that overrides it.
Converts the height of a PdfPage from points to pixels, scaling the source page height to the given target pixel height. The aspect ratio of the source page will be maintained so long as there is no call to PdfBitmapConfig::set_target_size() or PdfBitmapConfig::set_target_width() that overrides it.
Applies settings to this PdfBitmapConfig suitable for filling the given screen display size.
The source page’s dimensions will be scaled so that both width and height attempt to fill, but do not exceed, the given pixel dimensions. The aspect ratio of the source page will be maintained. Landscape pages will be automatically rotated by 90 degrees and will be scaled down if necessary to fit the display width.
Converts the width and height of a PdfPage from points to pixels by applying the given scale factor to both dimensions. The aspect ratio of the source page will be maintained. Overrides any previous call to PdfBitmapConfig::scale_page_by_factor(), PdfBitmapConfig::scale_page_width_by_factor(), or PdfBitmapConfig::scale_page_height_by_factor().
Converts the width of the PdfPage from points to pixels by applying the given scale factor. The aspect ratio of the source page will not be maintained if a different scale factor is applied to the height. Overrides any previous call to PdfBitmapConfig::scale_page_by_factor(), PdfBitmapConfig::scale_page_width_by_factor(), or PdfBitmapConfig::scale_page_height_by_factor().
Converts the height of the PdfPage from points to pixels by applying the given scale factor. The aspect ratio of the source page will not be maintained if a different scale factor is applied to the width. Overrides any previous call to PdfBitmapConfig::scale_page_by_factor(), PdfBitmapConfig::scale_page_width_by_factor(), or PdfBitmapConfig::scale_page_height_by_factor().
Specifies that the final pixel width of the PdfPage will not exceed the given maximum.
Specifies that the final pixel height of the PdfPage will not exceed the given maximum.
Applies the given rotation setting to the PdfPage during rendering, irrespective of its orientation. If the given flag is set to true, then any maximum constraint on the final pixel width set by a call to PdfBitmapConfig::set_maximum_width() will be rotated so it becomes a constraint on the final pixel height, and any maximum constraint on the final pixel height set by a call to PdfBitmapConfig::set_maximum_height() will be rotated so it becomes a constraint on the final pixel width.
pub fn rotate_if_portait(
self,
rotation: PdfBitmapRotation,
do_rotate_constraints: bool
) -> Self
pub fn rotate_if_portait(
self,
rotation: PdfBitmapRotation,
do_rotate_constraints: bool
) -> Self
Applies the given rotation settings to the PdfPage during rendering, if the page is in portrait orientation. If the given flag is set to true and the given rotation setting is PdfBitmapRotation::Degrees90 or PdfBitmapRotation::Degrees270 then any maximum constraint on the final pixel width set by a call to PdfBitmapConfig::set_maximum_width() will be rotated so it becomes a constraint on the final pixel height and any maximum constraint on the final pixel height set by a call to PdfBitmapConfig::set_maximum_height() will be rotated so it becomes a constraint on the final pixel width.
pub fn rotate_if_landscape(
self,
rotation: PdfBitmapRotation,
do_rotate_constraints: bool
) -> Self
pub fn rotate_if_landscape(
self,
rotation: PdfBitmapRotation,
do_rotate_constraints: bool
) -> Self
Applies the given rotation settings to the PdfPage during rendering, if the page is in landscape orientation. If the given flag is set to true and the given rotation setting is PdfBitmapRotation::Degrees90 or PdfBitmapRotation::Degrees270 then any maximum constraint on the final pixel width set by a call to PdfBitmapConfig::set_maximum_width() will be rotated so it becomes a constraint on the final pixel height and any maximum constraint on the final pixel height set by a call to PdfBitmapConfig::set_maximum_height() will be rotated so it becomes a constraint on the final pixel width.