pdf-inspector

2026-08-14 · page · source ↗ · raw capture · source summary

Firecrawl's Rust library for classifying PDFs and extracting text-to-Markdown without OCR or ML models. The core insight is a routing decision: ~54% of PDFs are already text-based and can be parsed locally in under 200ms, so detect cheaply first, extract natively for the majority, and hand only the scanned/vector/image remainder to an OCR service. A ~127K-line Rust codebase (single lopdf dependency) with Python, Node, and browser-WASM bindings.


Architecture

A two-stage pipeline over a shared document load (src/lib.rs loads the PDF once and passes it to both stages):

Three public result types carry the whole design: PdfProcessResult (pdf_type, markdown, page_count, processing_time_ms, pages_needing_ocr, confidence, layout, has_encoding_issues), TextItem/TextLine, and LayoutComplexity (src/types.rs).

Key techniques

Design decisions

Comparison notes

#tool #project #document-processing #pdf #markdown #rust


Sources: raw/pdf-inspector, pdf-inspector Last updated: 2026-08-14