Skip to main content

blank_document

Function blank_document 

Source
pub fn blank_document(pages: &[Size]) -> Result<Document, Error>
Expand description

A document of blank pages, one per entry of pages, each width by height points and in that order.

Every page has only /Type, /Parent and /MediaBox, so a canvas drawn on it sees exactly that box as its space. An empty pages is a document with an empty page tree.

ยงErrors

Error::BadPageSize when a size is not finite and positive: a page with no area has no space to draw in.

use pdfrum_edit::{Size, blank_document};

let doc = blank_document(&[Size::new(595.0, 842.0), Size::new(612.0, 792.0)])?;
assert_eq!(doc.page_count(), 2);