Skip to main content

RenderConfig

Struct RenderConfig 

Source
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

Source

pub const DEFAULT_MAX_OUTPUT_BYTES: u64

Default output-size ceiling: 1 GiB of pixel data.

Source

pub fn new() -> RenderConfig

A configuration rendering at 1:1 (72 DPI), BGRA, white background, annotations and form fields on, 1 GiB output cap.

Source

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.

Source

pub fn dpi(self, dpi: f32) -> Self

Resolution in dots per inch (72 DPI == scale 1.0).

Source

pub fn width(self, pixels: u32) -> Self

Fixed output width in pixels, preserving aspect ratio.

Source

pub fn height(self, pixels: u32) -> Self

Fixed output height in pixels, preserving aspect ratio.

Source

pub fn fit(self, width: u32, height: u32) -> Self

Largest output that fits in width×height, preserving aspect ratio.

Source

pub fn exact(self, width: u32, height: u32) -> Self

Exact output dimensions (may distort the aspect ratio).

Source

pub fn pixel_format(self, format: PixelFormat) -> Self

Output pixel format (default PixelFormat::Bgra8).

Source

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.

Source

pub fn annotations(self, on: bool) -> Self

Render annotations (default true).

Source

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.

Source

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.

Source

pub fn text_antialiasing(self, on: bool) -> Self

Toggle text anti-aliasing (default true).

Source

pub fn image_antialiasing(self, on: bool) -> Self

Toggle image anti-aliasing (default true).

Source

pub fn path_antialiasing(self, on: bool) -> Self

Toggle path anti-aliasing (default true).

Source

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

Source§

fn clone(&self) -> RenderConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RenderConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RenderConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for RenderConfig

Source§

fn eq(&self, other: &RenderConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RenderConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.