firecrawl

pdf-inspector: Classify PDFs and Extract Text as Markdown

pdf-inspector is a Rust library and set of bindings for classifying PDFs, extracting positioned text, and converting documents to Markdown. It helps processing pipelines route scanned pages to OCR while handling text-based pages locally.

Stars
19.5k
Forks
1.3k

Our take

Health score

59/100

How it is scored
Activity
78
Community
24
Issues
55
Pull requests
77
  • Merges more pull requests than 82% of the projects we track

Overview

pdf-inspector is a Rust PDF classification and extraction library, with Python, Node.js, and browser WebAssembly bindings plus command-line tools. It distinguishes text-based, scanned, image-based, and mixed documents, then extracts text and structures it as Markdown.

It is useful when a PDF pipeline needs to decide which pages require OCR instead of sending every document to an OCR service. Text extraction and classification run locally, while OCR is an optional path for pages that need it.

Key Features

  • Classifies PDFs and reports confidence and pages that may need OCR.
  • Extracts positioned text, including font and coordinate information, and determines reading order for multi-column layouts.
  • Converts common document structures such as headings, lists, tables, links, and code blocks to Markdown.
  • Supports Rust, Python, Node.js, browser WebAssembly, and CLI workflows.
  • Detects broken font encodings that may warrant OCR fallback.
  • Offers selective OCR in supported native integrations, with per-page routing and provenance.

Use Cases

  • Document-processing teams can route text-based PDFs through local extraction and send only scanned pages to OCR.
  • Developers building search or retrieval pipelines can turn reports and research papers into structured Markdown.
  • Finance and operations teams can extract text and tables from invoices and financial documents for downstream processing.
  • Legal and research workflows can inspect page-level text and reading order before indexing or analysis.

Getting Started

Add the Rust library with:

cargo add pdf-inspector

See the repository README for Python, Node.js, WebAssembly, CLI, and OCR setup instructions.

Alternatives

  • docling: Docling handles PDFs and many other formats, producing structured representations and exports rather than focusing on PDF text positioning and page classification.
  • opendataloader-pdf: OpenDataLoader PDF parses scanned, digital, and tagged PDFs into structured output and can repair PDF tags, beyond text extraction and OCR routing.
  • marker: Marker converts PDFs and other documents into Markdown and structured formats, with local models for layout and content extraction.
  • xberg: Xberg extracts text, tables, metadata, and structured data across many file types, and offers CLI, API, and MCP interfaces.
ProjectLanguageLicenseStarsStatus
pdf-inspectorRustMIT19.5kNot checked yet
doclingPythonMIT68.3kActive
opendataloader-pdfJavaApache-2.029.5kActive
markerPythonApache-2.040.2kActive
xbergRustMIT9.4kActive

Considerations

  • OCR is optional, not part of the lightweight default Rust and browser builds. Native OCR paths require separately installed PDFium and ONNX Runtime libraries when OCR is routed.
  • Classification can sample pages by default, which prioritizes speed and may be less precise than scanning every page for mixed documents.
  • The project is MIT-licensed and not archived, based on the supplied repository metadata.

Found this useful?

Share it with someone who would like pdf-inspector.

Comparisons