pdf-inspector
pdf-inspector Deployment: Rust, Python, Node, WASM, and OCR Runtimes
Choose local CLI, service, browser WebAssembly, or native bindings while keeping PDFium and ONNX optional.

What you will learn
- Trace detection and layout stages
- Run native extraction and OCR safely
- Design provenance checks
Before you start
- Basic Git and command-line usage
- Comfort reading a project README
You can explain the project, run its documented first step, and decide what to verify before adopting it.
Key takeaways
- Deployment choice follows residency and runtime needs.
- OCR dependencies should not burden native-text paths.
- Malformed PDFs and missing runtimes need explicit errors.
Choose the boundary
Rust/CLI gives a compact local path, Python and Node expose application bindings, and browser WASM keeps parsing client-side. Pick based on data residency, throughput, and integration rather than language preference alone.
Use the pinned source evidence, record versions and assumptions, and ask a qualified reviewer to validate the result before adopting it.
Keep OCR optional
Default Rust/browser builds remain pure extraction. Native OCR needs separately installed PDFium, ONNX Runtime, and model files only when pages are routed; document those platform dependencies explicitly.
Operate
Pin crate/npm/PyPI versions, model caches, feature flags, and sample PDFs. Test malformed files, large pages, missing OCR libraries, worker cancellation, and disk cleanup before exposing a service.
Use the pinned source evidence, record versions and assumptions, and ask a qualified reviewer to validate the result before adopting it.
Decision guide
| Criterion | Option A | Option B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
Implementation steps
- 1
Select CLI, binding, or WASM boundary.
- 2
Pin versions and optional OCR runtimes.
- 3
Run smoke and failure fixtures.
- 4
Monitor latency, memory, cache, and cleanup.
Copy-ready example
cargo install pdf-inspector
# OCR build only when needed
cargo install pdf-inspector --features ocr --bin pdf2md
PDFIUM_LIB_PATH=/path/to/libpdfium ORT_DYLIB_PATH=/path/to/libonnxruntime pdf2md scan.pdf --ocr auto --jsonFrequently asked questions
Can browser WASM call PDFium?
The documented browser path uses the Rust parser and embedded CMaps; native OCR dependencies are a separate boundary.
Should OCR libraries be in every container?
No. Keep them in workers that actually receive routed pages.
Sources
- pdf-inspector README (captured 2026-08-31)Source checked 2026-08-31
- pdf-inspector repositorySource checked 2026-08-31