Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsSep 12, 2026·3 min de lecture

pdf-inspector — Fast PDF Inspection and Classification Library in Rust

A Rust library for inspecting, classifying, and extracting text from PDF files, enabling smart routing between text-based and scanned document processing pipelines.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
pdf-inspector Overview
Commande d'installation directe
npx -y tokrepo@latest install 2443b95c-ae6a-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

pdf-inspector is an open-source Rust library with Python bindings for inspecting and classifying PDF documents. Built by the Firecrawl team, it detects whether a PDF contains extractable text or is a scanned image, enabling intelligent routing to the right processing pipeline. This avoids wasting OCR resources on text-based PDFs and missing content in scanned ones.

What pdf-inspector Does

  • Classifies PDFs as text-based, scanned, or mixed content
  • Extracts text from text-based PDFs without OCR overhead
  • Provides page-level metadata including dimensions and content type
  • Offers both Rust and Python APIs for integration flexibility
  • Processes documents with minimal memory and CPU usage

Architecture Overview

The library is written in Rust for performance and safety, with Python bindings generated via PyO3. It parses the PDF structure directly to detect embedded text streams versus image-only pages. Classification uses heuristics based on text density per page area, avoiding the need for machine learning models while maintaining high accuracy.

Self-Hosting & Configuration

  • Install via pip for Python projects or Cargo for Rust projects
  • No external dependencies or services required
  • Configure classification thresholds via the API for edge cases
  • Integrate into existing document processing pipelines as a pre-filter
  • Works on Linux, macOS, and Windows

Key Features

  • Sub-second classification for most documents
  • Zero external dependencies beyond the PDF parser
  • Accurate mixed-content detection at the page level
  • Node.js bindings available alongside Python and Rust
  • Thread-safe for concurrent document processing

Comparison with Similar Tools

  • PyMuPDF (fitz) — Full-featured PDF library; pdf-inspector focuses specifically on classification and routing
  • pdfplumber — Python-only text extraction; pdf-inspector adds classification and is faster via Rust
  • Apache Tika — JVM-based with broad format support; pdf-inspector is lightweight and PDF-specific
  • Docling — AI-powered document parsing; pdf-inspector is a simpler heuristic-based pre-filter

FAQ

Q: When should I use pdf-inspector instead of a full PDF library? A: When you need to decide how to process a PDF before extracting content, for example routing scanned PDFs to OCR and text PDFs to a text extractor.

Q: Does it handle encrypted PDFs? A: It can inspect unencrypted PDFs and password-protected ones if you provide the password.

Q: How accurate is the classification? A: It achieves high accuracy on common document types using text density heuristics without needing ML models.

Q: Can I use it in a serverless environment? A: Yes. The library has no external dependencies and starts instantly.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires