A fast Rust library and CLI that tells scanned PDFs from text-based ones and converts text PDFs to Markdown without OCR.
open sourceMIT
pdf-inspector is a Rust library from Firecrawl for classifying PDFs and extracting their text. It samples a PDF's content streams to say whether it's text-based, scanned, image-based or mixed, with per-page OCR routing, so you send only the pages that need it to an OCR service. For text PDFs it extracts position-aware text and converts it to Markdown with headings, lists, tables, code blocks and multi-column reading order. It has a CLI, Python and Node.js bindings and a browser WebAssembly build, and can optionally run local OCR on the pages that need it.
Problems it solves
- detect whether a PDF is scanned so I only pay for OCR when I need it
- convert text PDFs to Markdown for an LLM quickly without OCR
- extract tables and text from PDFs locally in Rust or Python
Features
- classifies PDFs as text-based, scanned, image-based or mixed with per-page OCR routing
- PDF to Markdown with headings, lists, tables and multi-column reading order
- Python, Node.js and browser WebAssembly bindings
- optional local OCR for only the pages that need it
Alternatives
The same job
These do what pdf-inspector does.
- MarkItDown Python tool for converting files and office documents to Markdown
- LiteParse A fast, local, open source document parser with OCR and bounding boxes
- OpenDataLoader PDF Open source PDF parser for AI-ready data and PDF accessibility auto-tagging
- PyMuPDF A high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.