Classify PDFs locally to skip unnecessary OCR costs
Determine whether a PDF contains text or is a scanned image in 10 to 50 milliseconds without opening the document. This tool analyzes the PDF content directly to classify it as text-based or scanned, converting it to Markdown quickly only when text is present. It skips unnecessary optical character recognition (OCR) steps, reducing both processing time and cost.
Smart routing to reduce processing costs
Most PDF pipelines process every file in the same way, but applying OCR to PDFs that already contain text wastes time and money. This tool samples the PDF content stream to classify files as text-based, scanned, image-based, or mixed. If a file is identified as text-based, it completes the Markdown conversion locally in under 200 milliseconds and selectively processes only the pages that require OCR. According to the README, approximately 54% of all PDFs can be processed without OCR.
Layout-aware text extraction
It converts documents to Markdown by understanding their structure rather than simply listing text. It analyzes font size ratios to distinguish heading levels from H1 to H4 and applies bold or italic styles based on font name patterns. The tool automatically detects multi-column layouts to correctly reconstruct the reading order of newspaper-style articles. Tables are detected using a dual mode based on rectangular shapes and text alignment, handling financial statements, footnotes, and tables that span multiple pages. Rotated text, such as margin stamps or chart axis titles, retains its original axis-aligned box and reports the rotation angle.
Execution in various environments
The tool is available as a Rust library, a CLI tool, and for Python, Node.js, and browser WebAssembly environments. The default build includes only pure extraction features to remain lightweight, loading external libraries only when OCR is required. Python and Node.js packages include optional OCR functionality, so PDFs with clean text do not load an external OCR runtime. In the browser, the same parser runs locally without server round-trips.
Benchmark results and suitability
Evaluated on the opendataloader-bench corpus (200 PDFs) with OCR disabled, pdf-inspector recorded a composite score of 0.875, a reading order (NID) score of 0.915, a table (TEDS) score of 0.814, and a heading (MHS) score of 0.788. The processing speed for 200 documents was 0.470 seconds. These scores and speeds were higher and faster than those of the comparison targets: liteparse, opendataloader, pymupdf4llm, and markitdown. It is particularly suitable for reports, research papers, financial documents, invoices, and legal documents where table structure and reading order are important. It serves as a default tool for local environments that need clean, structured Markdown without OCR latency or additional infrastructure.
Pre-use considerations
This tool performs best with text-based PDFs. Scanned or image-based PDFs require OCR routing, which necessitates separately installing the PDFium and ONNX Runtime libraries. For Rust and CLI users, the OCR feature must be selected at build time, while it is included in the Python and Node.js packages. Distributed under the MIT license, it allows users to verify parser settings, per-document predictions, and evaluator outputs from a reproducible results branch. It is suitable for large-scale PDF processing pipelines aiming to reduce OCR costs or for local environments requiring fast Markdown conversion.