A highly opinioned PDF rendering library based on Poppler C++ bindings.
This does not use Cairo backend but rather the built-in poppler backend.
For multi-threaded exporters (like the npdf CLI) prefer using DocumentFactory:
- Call
DocumentFactory::with_images(path)once on the main thread to parse the file, cache the page count, and snapshot image metadata for heuristics. - Clone the factory for each worker thread and call
factory.open()to obtain an isolatedDocumentbound to that thread. - Never share a
Documentbetween threads; Poppler expects eachPDFDocinstance to be used from a single thread at a time.
This pattern amortizes the expensive parse step while keeping each renderer thread-safe.
The crate exposes optional build features that wire common compiler sanitizers through the
Poppler build and the C++ bridge. Enable exactly one of asan, lsan, tsan, or ubsan when
invoking Cargo to instrument native code:
cargo test -p tiny-poppler --features asanWhen enabled, the build script also surfaces tiny_poppler_has_sanitizer and
tiny_poppler_sanitizer="<name>" configuration flags at compile time so downstream crates can
adjust behaviour if needed.