Skip to main content

emit

Function emit 

Source
pub fn emit(
    graph: &PageGraph,
    metadata: &PdfMetadata,
    out: &Path,
) -> Result<Vec<Diagnostic>>
Expand description

Emit graph as a PDF file at out. Creates out’s parent directory if it doesn’t already exist.

Returns any diagnostics raised during PDF emission; currently only MOS0032 (per-font extended-glyph budget exhausted). Layout diagnostics flow through [mos_layout::LayoutResult::diagnostics] separately; callers (the CLI) typically render both.

§Errors

Returns a wrapped [Diagnostic] if writing the file (or creating its parent directory) fails.

§Examples

use std::path::Path;

use mos_layout::PageGraph;
use mos_pdf::PdfMetadata;

let graph = PageGraph::default();
let metadata = PdfMetadata::default();
let diagnostics = mos_pdf::emit(&graph, &metadata, Path::new("build/main.pdf"))?;

assert!(diagnostics.is_empty());