Skip to main content

render_page

Function render_page 

Source
pub fn render_page<B: RasterBackend>(
    page: &Page,
    opts: &RenderOptions,
    backend: &B,
    diags: &mut Diagnostics,
) -> Result<Pixmap, Error>
Expand description

Render a page into a pixmap.

The target size comes from the page’s display box under opts.transform; the background follows the oracle — opaque white for a page without transparency, fully transparent for one with it — unless overridden, and that choice is load-bearing rather than cosmetic.

Every page gets its own caches and every object is drawn. A caller that wants either of those different — a run over many pages, or a document with optional content — calls render_page_with instead, which is this function with a RenderSession the caller fills in.

§Errors

Error::TargetEmpty when the page’s box under opts.transform is not at least one pixel on both axes (a zero, negative or non-finite size), and Error::TargetTooLarge when either axis exceeds MAX_TARGET_DIMENSION. Damage inside the page is reported through diags and never becomes an error.