Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsSep 12, 2026·3 min de lectura

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.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
pdf-inspector Overview
Comando de instalación directa
npx -y tokrepo@latest install 2443b95c-ae6a-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con 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

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados