Skip to main content

Module dparse_render

Module dparse_render 

Source
Expand description

Opt-in page-image plugin: docling-parse’s Blend2D renderer, loaded at runtime (#478).

docling 2.123+ renders every page image its model stages consume — the scale-1.0 layout input, the scale-2.0 TableFormer input, the OCR and enrichment crops — with docling-parse’s own renderer (FreeType glyph outlines filled by Blend2D), while this pipeline renders them with pdfium exactly like docling’s PyPdfiumDocumentBackend. The two rasters differ at every glyph edge (10 % of the corpus pixels by > 8/255), and heron’s borderline labels follow the pixels. This module lets the pipeline consume docling’s raster instead: a small C shim over renderer<BLEND2D> (crates/docling-pdf/ffi/docling-parse-render/dparse_render.cpp, built by scripts/install/build_docling_parse_render.sh) is dlopened the way pdfium is, and Doc::render hands back the RGBA canvas docling’s get_page_image(scale) would.

Selection is an environment knob, never a build feature: nothing links the C++ side, CI and wasm are untouched, and a missing library degrades to pdfium with one warning.

  • DOCLING_RS_RENDERER — pdfium (default) or docling-parse.
  • DOCLING_PARSE_RENDER_LIB — the shim library (a file, or the directory holding libdparse_render.so/.dylib); default .docling-parse/lib resolved like .pdfium/lib ([crate::resolve_asset]).
  • DOCLING_PARSE_RESOURCES — docling-parse’s pdf_resources directory (fallback fonts, encodings, cmaps); default <lib dir>/../pdf_resources, where the build script installs it.

The renderer is docling-parse’s, so its output is compared against the Python package’s PageParseResult.get_image(scale) byte for byte (scripts/conformance/dparse_render_check.py); everything downstream — the Pillow-exact 640 stretch, the TableFormer crop chain — is unchanged.

Structs§

Doc
A PDF opened by docling-parse; renders its pages on request.
Plugin
The loaded shim: the library plus its resolved entry points. One per process, behind plugin.

Functions§

plugin
The plugin when DOCLING_RS_RENDERER=docling-parse and the shim loads; None otherwise. A requested-but-unloadable plugin warns once and the pipeline keeps rendering with pdfium (degradation over failure).
requested
Is the docling-parse renderer requested (DOCLING_RS_RENDERER=docling-parse)?