Skip to content

The system checks every PDF page and pays for OCR only when the page is a scan.

One inbox may contain ordinary PDFs, scans, and mixed documents. The gate chooses a reading method for each page. It records the decision, the reason, and the charge beside the file.

OCR only for pages that need itDemonstration systemCheck the OCR cost on your PDFs

What we measured

The demonstration contains no client data or credentials. It processes public documents and prepared test files. Results on the client’s documents must be measured separately.

Recorded measurement
What we measured
181 PDFs · 496 pages · 11 structural checks
OCR only for pages that need it
Verified
mixed corpus

Problem, solution, and result

  1. The problem

    One document stream contains native PDFs, scans, and mixed files. Sending everything through paid OCR raises cost and can degrade text that was already available in the original file.

  2. How it works

    An inspector checks the text layer on every page. Native text stays on the local path, while only identified scans enter OCR. A document with a damaged text layer is held for review.

  3. 432 of 496 pages skipped OCR

    The demonstration contains no client data or credentials. It processes public documents and prepared test files. Results on the client’s documents must be measured separately.

For whom

This system fits teams that receive text-based PDFs, scans, and mixed documents through one process and currently send every page to paid OCR.

File → inspection → route → bill

  1. 01Every page gets its own decision before any cost flows
  2. 02Pages with trusted text pass locally; the tariff charges OCR pages only
  3. 03Damaged text holds the document in the operator's review queue
Business type
Companies processing large volumes of scanned and mixed PDFs
Input
One PDF stream covering native files, scans, and mixed documents; 181 files and 496 pages
Boundary
A damaged text layer holds the document in human review
Cost
PLN 5.12 for OCR across the full 181-file run, plus about PLN 0.0035 for a separate document read.
Security
A damaged or unreadable document goes to a person instead of continuing as valid.
Trace
The history shows the file source, chosen reading method, check result, and human decision.
Similar system build
from €3,500 net (approx. $3,800) · 2–6 weeks

The gateway's boundary

A doubtful document waits for a person

A document with a damaged text layer stops in the review queue with the reason recorded beside the file, and the document operator decides where it goes next. A file that is not a valid PDF never enters the process at all; the run records one such controlled rejection. Every document's route can be checked in the public audit, without database access.

Boundary
A damaged text layer holds the document in human review
Cost
PLN 5.12 for OCR across the full 181-file run, plus about PLN 0.0035 for a separate document read.
Security
A damaged or unreadable document goes to a person instead of continuing as valid.

The file that passed the wrong route

The demonstration exposes a known limit. Some archival files contain a damaged text layer that looks valid to the system even though a person can see corrupted characters. The public set also contained no original scan-only document, so that route uses prepared copies of archival pages. Production needs OCR monitoring and a manual queue for uncertain results.

Estimated impact

Calculate the impact at your volume

This estimate uses the stated volume. Enter your own numbers to assess the possible impact in your company. The result is confirmed only during a pilot.

  1. Today

    Current assumption: 245 h/month

  2. With the system

    After scenario: 56 h/month

  3. Time or cost saved

    Modelled outcome: 145-230 h/month, 189 h base case

Volume
Modelled scenario: 4,200 PDFs/month
Formula
4200 x 2.7 min / 60
Calculation status
medium

Data in the screenshots. The names, amounts, and documents shown in the screenshots are synthetic. Client data remains private. Measurements describe the demonstrator and are kept separate from production outcomes.

Working surfaces

The operator no longer opens every file: only documents the gateway stopped trusting reach a person's decision.

The team opens one stream: each file shows its route, its local reading time, and the cost charged to it. What passed locally for nothing, what went through OCR and why, and what is waiting for a human decision are all visible. A flat charge on the whole inbox turns into a list of specific pages at a specific rate. On client volumes the time distribution and the full operating cost still have to be measured before anyone states an SLA.

The PDF gateway: stream, bill, trace.

Document stream

Every file with its type, route, reading time, and cost in one table, from native files to escalations.

The bill

OCR cost tallied from events, line by line, next to the pages read locally for nothing.

The trace

A public JSON audit with each file's route and hashes, checkable without touching the database.

System screens

See how the system works in practice

These desktop and mobile screenshots come from the running application. They show the process and the points where a person makes the decision.

Screens
11
px
1440 · 390
011440×1100
The PDF intake gateway: the two-route diagram, 432 of 496 pages skipping OCR, and a stream of 181 documents with routes and tariff-based cost.
390390×844
  1. 021440×1953
    Local and OCR routing for each page separately, with evidence expanded for the hybrid and the corrupted file.
  2. 031440×1100
    The document stream framed on a phone.
Open the remaining screen archive (8)
  1. 041440×1100
    Routed to OCR
  2. 051440×1100
    Rejected at intake
  3. 061440×1100
    The reading bill
  4. 071440×1100
    Classification trail
  5. 081440×1100
    Routing rules
  6. 091440×1100
    Held for review
  7. 101440×1100
    A scan without a text layer
  8. 111440×1100
    A corrupted text layer

Technology stack

PDF routing is deterministic, so code solves it and no language model appears.

A pinned inspection library routes each page to local reading or OCR because that decision comes from the file itself. A separate model step can read the routed document and records the complete provider trace. OCR and model costs therefore remain separate and visible.

pdf-inspector 0.7.0
classifies the PDF page by page and reads native text, from a pinned revision
Tesseract 5
local OCR in Polish and English, in its own container, for flagged pages only
Python 3.13 with FastAPI
runs the gateway: accepts files, enforces the routes, and records the events
PostgreSQL 17
stores documents, each page's route, and the audit hash chain
Next.js 16
the operator's screens: document stream, bill, and the public JSON audit

The client owns the code, the routing configuration, the evaluation data, and the documentation, and the whole thing runs on their infrastructure. We use open components at pinned versions, and both reading and OCR happen inside the stack, so no step sends documents to an outside service.

Technical details and measurements

The working loop

Cheap classification before expensive reading. Always in that order.

Inspection settles each page's route before any cost flows. Doubtful text ends up with a reviewer rather than travelling on as correct.

01

A PDF stream: native files, scans, hybrids

02

Inspection: a separate decision for every page

03

Trusted text → local reading, no charge

Scan → OCR for flagged pages · damaged text → review

04

Route, time, and cost recorded beside every file

System architecture

The inspector, two routes, escalation, and a hash chain.

Deterministic classification at the entrance, local extraction and isolated OCR as separate routes, and an audit closed around every tool.

  1. 01

    Inspection

    Classification page by page.

    pdf-inspector, from a pinned revision, recognizes the document type and flags pages without a usable text layer. A hybrid gets a decision for each page separately rather than one label for the whole file.

  2. 02

    Local route

    Native text read with no OCR charge.

    Pages with a trusted text layer pass local extraction, so their content is not degraded by a second reading and the tariff charges nothing for them.

  3. 03

    OCR route

    Isolated Tesseract, flagged pages only.

    OCR runs inside the stack, in its own container on an internal network, with Polish and English. It is invoked only for the pages inspection flagged, and the bill applies the stated tariff to those pages line by line.

  4. 04

    Escalation and audit

    Damaged text goes to a human.

    A distorted text layer escalates the whole document to review, and a continuous hash chain is written before and after every tool. Each file's route can be verified in the public audit.

Why there is no language model here

component choice follows the measurement, and here it had nothing to offer. Whether a page has a usable text layer is a property of the file, and deterministic inspection measures it. A model inside that decision would add cost and uncertainty while adding no information. Part of the engineering is recognizing where a model contributes nothing.

  • The routing decision is made by deterministic inspection
  • OCR cost is visible for each page separately
  • A hash chain closes the audit around every tool
  • A doubtful document always ends at human review

Want to assess a similar process in your company?

  • A 30-minute call with the engineer who would lead the work.
  • A review of the processes that cost you the most time and money.
  • A written summary of what to automate first and the likely cost range.
€030 minutes · written takeaway within 2 business days
Book a free process scan (30 min)

Times are shown in your own time zone. We work with clients across time zones.

The scan is free and creates no obligation. If automation is unlikely to pay off, the written recommendation will say so.