Most PDF pipelines waste time and money running OCR on every file. This library flips that cost model: by quickly identifying which pages actually contain extractable text and then extracting position-aware content into clean Markdown, it lets pipelines skip OCR for the sizable fraction of PDFs that are already native-text.
What Sets It Apart
- Fast, sampling-based classification: detects TextBased/Scanned/ImageBased/Mixed PDFs in ~10–50 ms and returns per-page OCR routing so you only OCR what needs it. This reduces end-to-end latency compared with blind OCR-first pipelines.
- Low-latency extraction tuned for structure: position-aware text items with font and XY data, automatic multi-column reading order, rectangle+heuristic table detection, heading tiers, lists, code block detection, URL linking, and Markdown conversion — all without ML models or external services.
- Benchmarked and pragmatic: on a 200-document corpus it scored 0.875 overall and completed the run in a median 0.470s (engine run on Apple M4 Pro), making it a competitive local default when reading order and table fidelity matter.
- Practical engineering trade-offs: single-document parse shared across detection and extraction to avoid redundant I/O, ToUnicode/CID font handling, encoding issue detection that flags pages to fall back to OCR when necessary, and browser WebAssembly support for client-side parsing.
Who It's For — and When Not To Use It
Great fit if you operate document-processing pipelines where many PDFs are already native-text (reports, papers, invoices, legal docs) and you need fast, structured Markdown or per-page OCR routing to cut cost and latency. Look elsewhere if your corpus is predominantly scanned-image PDFs and you require built-in OCR: pdf-inspector intentionally omits OCR and focuses on accurate, high-speed extraction for text-based content (it will flag pages that need OCR instead of performing it).