Fast PDF inspection, classification, and text extraction with smart scanned vs text-based detection
Actively maintained. Last release 6 days ago, commits in 17 of the last 26 weeks. A safe choice.
pip install pdf-inspectorpdf-inspector
Fast PDF classification, text extraction, and selective OCR. Detects whether a PDF is text-based or scanned, extracts text with position awareness, and converts clean native and OCR results to Markdown. Python bindings via PyO3 for the pdf-inspector Rust library.
Built by Firecrawl to handle text-based PDFs locally in under 200ms, skipping expensive OCR services for the ~54% of PDFs that don't need them.
Features
- Smart classification —
text_based/scanned/image_based/mixedin ~10–50ms, with a confidence score and per-page OCR routing. - Markdown conversion — headings, lists, code blocks, bold/italic, URL linking, and dual-mode table detection (PDF drawing ops + text-alignment heuristics).
- Layout-aware extraction — multi-column reading order, position and font info per text item, RTL support.
- Robust text decoding — CID/Type0 fonts via ToUnicode CMaps, plus automatic flagging of broken encodings so callers can fall back to OCR.
- Selective OCR —
autoroutes only pages rejected by native extraction;forceOCRs every selected page;offkeeps the result/provenance contract without external runtime work. - External artifacts — the wheel embeds no OCR models, PDFium, or ONNX Runtime; clean
autorequests never load or download them.
Benchmark
opendataloader-bench corpus (200 PDFs), local engines without model-based PDF parsing; OCR disabled. Scores 0–1, higher is better:
| Engine | Overall | Reading order | Tables (TEDS) | Headings | Speed |
|---|---|---|---|---|---|
| pdf-inspector | 0.875 | 0.915 | 0.814 | 0.788 | 0.470s |
| liteparse | 0.873 | 0.913 | 0.693 | 0.811 |