PDF Inspector — Smart PDF Router
PDF Inspector is a from-scratch Rust library that reads a PDF's internal structure (font encodings, text operators, image coverage) in milliseconds and decides per page whether content is text-based or needs OCR — without rendering anything.
How It Works
- Read internal structure in milliseconds (no rendering)
- Classify per page: TextBased / Scanned / ImageBased / Mixed
- Text-based pages: Native extraction with reading order preserved
- Scanned pages: Flagged with reason, routed to vision pipeline
- Mixed documents: Smart routing — only scan pages that actually need it
Why Not Just OCR Everything?
Most PDF pipelines treat every page as potentially scanned — routing everything through OCR. That's slow (10-50x), expensive (GPU for text pages), and less accurate (native text > OCR). PDF Inspector is the smart router.
Key Features
- Font encoding analysis — detects encoding issues before extraction
- Text operator inspection — understands text placement in PDF
- Image coverage detection — identifies pure-image pages
- Markdown output — clean, structured output for AI pipelines
- Zero dependencies — pure Rust, no system libraries
- CLI + Library — use as command or Rust crate
When to Use
- Building document parsing pipelines
- Pre-processing PDFs before AI/LLM ingestion
- Large-scale document conversion with quality control
- Mixed-format document processing (text + scanned)