Repolode
firecrawl

firecrawl/pdf-inspector

Rust library and CLI that detects whether a PDF is text-based or scanned and converts text-based PDFs to clean Markdown without OCR.

Open-source alternative to:Adobe Acrobat

Stars
19,687
Forks
1,333
Open issues
250
Last commit
13 days ago

What is it?

pdf-inspector is a Rust library for PDF classification and text extraction. It samples content streams to decide whether a document is TextBased, Scanned, ImageBased, or Mixed, and reports a confidence score along with the specific pages that lack text. Text-based PDFs can be extracted locally with position-aware text, multi-column reading order, and Markdown output that includes headings, lists, code blocks, and tables.

The main use is routing: documents that already contain text can skip expensive OCR services, while only pages that need OCR are sent to it. Native Rust and CLI users can opt into selective OCR using PDFium and ONNX Runtime, which are installed separately. Bindings are available for Python, Node.js, and browser WebAssembly, and the default Rust and WASM builds run pure extraction.

Key features

  • 01Classifies PDFs as text-based, scanned, image-based, or mixed with a confidence score.
  • 02Extracts text with font info, coordinates, and multi-column reading order.
  • 03Converts pages to Markdown with headings, lists, code blocks, and tables.
  • 04Detects rectangle-based and heuristic tables, including tables continued across pages.
  • 05Runs selective OCR only on pages that need it, with PDFium and ONNX Runtime installed separately.
  • 06Provides Python, Node.js, and browser WebAssembly bindings alongside the CLI tools pdf2md and detect-pdf.

Use cases

  • Routing a document pipeline so text-based PDFs skip OCR and scanned pages are sent to it.
  • Converting reports, research papers, invoices, or financial statements into structured Markdown.
  • Running PDF text extraction in a browser without a server round trip.
  • Batch-processing large PDF collections by sampling pages to classify them quickly.

Quick start

  1. 1

    Install the Python package

    pip install pdf-inspector
  2. 2

    Install the Rust CLI tools

    cargo install pdf-inspector
  3. 3

    Convert a PDF to Markdown with the CLI

    pdf2md document.pdf

Things to know

  • Optional selective OCR needs separately installed PDFium and ONNX Runtime libraries.
  • Scanned or image-only pages are not converted to text unless OCR is enabled, which requires extra setup.

Topics

FAQ

What is pdf-inspector?
Rust library and CLI that detects whether a PDF is text-based or scanned and converts text-based PDFs to clean Markdown without OCR. pdf-inspector is a Rust library for PDF classification and text extraction. It samples content streams to decide whether a document is TextBased, Scanned, ImageBased, or Mixed, and reports a confidence score along with the specific pages that lack text. Text-based PDFs can be extracted locally with position-aware text, multi-column reading order, and Markdown output that includes headings, lists, code blocks, and tables.
Is pdf-inspector free to use? What license does it have?
pdf-inspector is open source under the MIT license. Check the license terms before using it in commercial products.
Is pdf-inspector still maintained?
Actively maintained. The last commit to pdf-inspector was on Oct 7, 2026.
What can I use pdf-inspector for?
Routing a document pipeline so text-based PDFs skip OCR and scanned pages are sent to it. Converting reports, research papers, invoices, or financial statements into structured Markdown. Running PDF text extraction in a browser without a server round trip. Batch-processing large PDF collections by sampling pages to classify them quickly.
How do I install pdf-inspector?
Install the Python package: pip install pdf-inspector Install the Rust CLI tools: cargo install pdf-inspector Convert a PDF to Markdown with the CLI: pdf2md document.pdf
Where can I get pdf-inspector?
The source code and installation instructions are on GitHub: https://github.com/firecrawl/pdf-inspector

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects