pdf-inspector
pdf-inspector: quickstart de clasificación, extracción y OCR
CLI y bindings para un flujo PDF con procedencia.

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
- Detection precedes extraction.
- Native parsing is the cheap default.
- OCR routing should remain page-specific.
Start with detection
Registra tipo, confianza y páginas OCR antes de generar Markdown/JSON; enruta solo páginas escaneadas o con encoding roto.
Use the pinned source evidence, record versions and assumptions, and ask a qualified reviewer to validate the result before adopting it.
Extract locally
Use position-aware text and Markdown conversion for text PDFs. Enable `--analyze`, `--items-json`, `--pages`, or `--select-pages` only when the downstream consumer needs those fields.
Route only what needs OCR
Call the OCR path for scanned or broken-encoding pages and retain per-page provenance. Do not send every document to an external OCR service by default.
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
Install a matching binding or CLI.
- 2
Detect type and confidence.
- 3
Extract Markdown/JSON and inspect warnings.
- 4
Enable OCR only for routed pages.
Ejemplo para copiar
pip install pdf-inspector
python - <<'PY'
import pdf_inspector
r = pdf_inspector.process_pdf('document.pdf')
print(r.pdf_type, r.markdown)
PY
detect-pdf document.pdf --analyze --jsonPreguntas frecuentes
Does every PDF need OCR?
No. Text-based pages can use native extraction; OCR is selective.
Can I parse only some pages?
Yes, the CLI documents `--select-pages` and related options.
Fuentes
- pdf-inspector README (captured 2026-08-31)Fuente verificada 2026-08-31
- pdf-inspector repositoryFuente verificada 2026-08-31