Skip to main content

convert_text_layer

Function convert_text_layer 

Source
pub fn convert_text_layer(
    bytes: &[u8],
    name: &str,
) -> Result<DoclingDocument, PdfError>
Expand description

Convert a PDF’s embedded text layer only — no pdfium, no ONNX, no threads: the pure-Rust content-stream parser (textparse) feeds the same orphan-region assembly the no_ocr pipeline flag uses, so text-layer PDFs come out identical to --no-ocr (flat, line-grouped paragraphs in reading order; no headings/lists/tables/pictures, and no hyperlink recovery).

This is the only conversion entry compiled without the ml feature (it is what a wasm32 build runs). A scanned/image-only PDF (no embedded text layer) yields an empty document rather than an error, same as no_ocr — callers can detect that and fall back to an OCR-capable build.