pub struct RenderConfig { /* private fields */ }Expand description
Configuration for PdfPage::render.
use firecrawl_pdfium::{RenderConfig, PixelFormat};
// 300 DPI grayscale, annotations off:
let config = RenderConfig::new()
.dpi(300.0)
.pixel_format(PixelFormat::Gray8)
.annotations(false);Implementations§
Source§impl RenderConfig
impl RenderConfig
Sourcepub const DEFAULT_MAX_OUTPUT_BYTES: u64
pub const DEFAULT_MAX_OUTPUT_BYTES: u64
Default output-size ceiling: 1 GiB of pixel data.
Sourcepub fn new() -> RenderConfig
pub fn new() -> RenderConfig
A configuration rendering at 1:1 (72 DPI), BGRA, white background, annotations and form fields on, 1 GiB output cap.
Sourcepub fn scale(self, factor: f32) -> Self
pub fn scale(self, factor: f32) -> Self
Scale factor over page points (2.0 renders a 612×792pt page at 1224×1584px). Mutually exclusive with the other size selectors; the last one set wins.
Sourcepub fn height(self, pixels: u32) -> Self
pub fn height(self, pixels: u32) -> Self
Fixed output height in pixels, preserving aspect ratio.
Sourcepub fn fit(self, width: u32, height: u32) -> Self
pub fn fit(self, width: u32, height: u32) -> Self
Largest output that fits in width×height, preserving aspect
ratio.
Sourcepub fn exact(self, width: u32, height: u32) -> Self
pub fn exact(self, width: u32, height: u32) -> Self
Exact output dimensions (may distort the aspect ratio).
Sourcepub fn pixel_format(self, format: PixelFormat) -> Self
pub fn pixel_format(self, format: PixelFormat) -> Self
Output pixel format (default PixelFormat::Bgra8).
Sourcepub fn background(self, color: Color) -> Self
pub fn background(self, color: Color) -> Self
Background color the page is composited over (default white). Use
Color::TRANSPARENT with an alpha format for compositing.
Sourcepub fn annotations(self, on: bool) -> Self
pub fn annotations(self, on: bool) -> Self
Render annotations (default true).
Sourcepub fn form_fields(self, on: bool) -> Self
pub fn form_fields(self, on: bool) -> Self
Draw AcroForm field appearances (default true). Takes effect only
when the document has
enable_form_rendering
active.
Sourcepub fn rotate(self, rotation: Rotation) -> Self
pub fn rotate(self, rotation: Rotation) -> Self
Extra rotation applied at render time, on top of the page’s own
/Rotate (default none). 90°/270° swap the output dimensions.
Sourcepub fn text_antialiasing(self, on: bool) -> Self
pub fn text_antialiasing(self, on: bool) -> Self
Toggle text anti-aliasing (default true).
Sourcepub fn image_antialiasing(self, on: bool) -> Self
pub fn image_antialiasing(self, on: bool) -> Self
Toggle image anti-aliasing (default true).
Sourcepub fn path_antialiasing(self, on: bool) -> Self
pub fn path_antialiasing(self, on: bool) -> Self
Toggle path anti-aliasing (default true).
Sourcepub fn max_output_bytes(self, limit: u64) -> Self
pub fn max_output_bytes(self, limit: u64) -> Self
Ceiling on the pixel buffer size in bytes
(default RenderConfig::DEFAULT_MAX_OUTPUT_BYTES, 1 GiB).
Renders that would exceed it fail with Error::RenderTooLarge
before allocating. Use u64::MAX to disable.
Trait Implementations§
Source§impl Clone for RenderConfig
impl Clone for RenderConfig
Source§fn clone(&self) -> RenderConfig
fn clone(&self) -> RenderConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more