pdf-inspector
Desplegar pdf-inspector: Rust, Python, Node, WASM y OCR
Elige límite local, servidor o navegador y deja OCR opcional.

Qué aprenderás
- Trace detection and layout stages
- Run native extraction and OCR safely
- Design provenance checks
Antes de empezar
- 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.
Conclusiones clave
- 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
Usa CLI, bindings o WASM según residencia; instala PDFium, ONNX y modelos solo en workers OCR y prueba archivos hostiles.
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.
Cómo elegir
| Criterio | Opción A | Opción 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 |
Pasos de implementación
- 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.
Ejemplo para copiar
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 --jsonPreguntas frecuentes
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.
Fuentes
- pdf-inspector README (captured 2026-08-31)Fuente verificada 2026-08-31
- pdf-inspector repositoryFuente verificada 2026-08-31