Skip to main content

layout_boxes

Function layout_boxes 

Source
pub fn layout_boxes(
    doc: &PdfDocument,
    page_index: usize,
    config: &RuntimeConfig,
) -> Result<Vec<LayoutBox>>
Expand description

The layout detector’s boxes for one page.

Renders (render_page_rgb), preprocesses (preprocess_to_nchw), runs LAYOUT_EP03 through the shared session, and post-processes as HF does. Page page_index counts from zero. Boxes come back in descending score order; an empty page reads back as an empty vector, not an error.

Model failures (missing file, checksum, runtime, inference) come back as EngineError::Io carrying the typed pdf_ocr::runtime::ModelError.