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.
DOCLING_RS_RENDERER—auto(default: docling-parse when the shim library resolves, pdfium otherwise, silently — the baselines intests/snapshotsanddocs/PDF_CONFORMANCE.mdare docling-parse’s, so a checkout with the library converts like the baselines and one without still converts),docling-parse(required: a missing library warns once and falls back to pdfium) orpdfium(never load the plugin).DOCLING_PARSE_RENDER_LIB— the shim library (a file, or the directory holdinglibdparse_render.so/.dylib); default.docling-parse/libresolved like.pdfium/lib([crate::resolve_asset]).DOCLING_PARSE_RESOURCES— docling-parse’spdf_resourcesdirectory (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.
Enums§
- Choice
- What
DOCLING_RS_RENDERERasks for.
Functions§
- active_
name - Which renderer produces the model inputs in this process:
"docling-parse"or"pdfium"— for diagnostics (--version-style banners, serve health). - choice
- The renderer
DOCLING_RS_RENDERERselects; unset, empty orautoisChoice::Auto, an unknown value warns once and counts asauto. - plugin
- The plugin when the shim loads and
choiceallows it;Noneotherwise. Underautoan unavailable library is a quiet (DOCLING_RS_DEBUG) note and the pipeline renders with pdfium; underdocling-parseit warns once first (degradation over failure either way). - requested
- Is the docling-parse renderer explicitly requested?