Gabriel Pina
Back to workPDF OCR Triage
project

PDF OCR Triage

A browser tool that inspects each PDF, decides whether it holds real text or is a scanned image, and routes only the scans to paid OCR — built as a working proof of concept from the firecrawl/pdf-inspector repo.

Most document pipelines OCR everything by default. But a large share of the PDFs a business actually handles — exported invoices, generated contracts, digital statements, anything produced by software rather than a scanner — already carry a real, selectable text layer. Running those through OCR spends money to re-derive text that was sitting right there.

The cost is easy to underestimate because the headline number is small. Plain text OCR runs about $1.50 per 1,000 pages across the major clouds. The bill actually lands on the useful kind of extraction: pulling structured fields off invoices, forms, and tables costs roughly $10 per 1,000 pages and climbs to $65–70 per 1,000 for full forms-plus-tables processing. A team pushing hundreds of thousands of pages a month is paying real money — and pdf-inspector's own figure is that around 54% of a typical corpus can skip OCR entirely.

You don't need to open a document to know which bucket it belongs in; its structure gives it away. A text-based PDF carries embedded fonts and text-drawing operators. A scan is essentially one image per page, flagged by image objects and image filters like DCTDecode or CCITTFax. Sampling those signals classifies a file in tens of milliseconds — no OCR, no rendering, no cost.

The proof of concept is a single-file browser tool built from one clear prompt against the repo. Drop in a batch of PDFs and each is sorted into "has real text — extract it for free" or "this one's a scan — send it to OCR," with a confidence score and a running tally of the OCR spend avoided at your own per-page rate. It runs entirely client-side, so nothing leaves the machine — which matters when the documents are client data.

The browser version has an honest ceiling: it reads the usually-uncompressed object dictionary, so heavily compressed content streams can hide the text operators, where the production Rust library decompresses them for precision. But the point isn't this one tool — it's the pattern. Any team handling invoices, contracts, or forms at scale can put a cheap classification step in front of OCR and turn a flat per-page cost into a per-page decision.

Built with

Vanilla JS
Single-file HTML
PDF structure heuristics

Want something like this built? Get in touch.