OCR โ Optical Character Recognition โ is the technology that turns a scanned or photographed document into machine-readable text. For invoices, it is the first step in automating data entry. But raw OCR is only part of the picture. Understanding how it works helps you choose the right tool and get reliable results.
What OCR actually does
A PDF invoice from your accounting software has text already embedded โ you can copy and paste it. But a scanned invoice, a photographed receipt, or a PDF exported from an older system often contains images of text, not text itself.
OCR works in stages:
-
Pre-processing โ the image is deskewed, denoised, and binarised (converted to black and white). This removes shadows, corrects rotation, and improves contrast.
-
Text detection โ the engine finds regions of the image that contain characters. It draws bounding boxes around words, lines and paragraphs.
-
Character recognition โ each character region is compared against a trained model. The model returns the most likely character and a confidence score.
-
Post-processing โ common errors are corrected using dictionaries and language models.
0andO,1andI,5andSare frequent confusions.
The output is a sequence of characters with positions and confidence scores. By itself, it does not know what an invoice number is.
The gap between OCR and invoice extraction
This is where most simple "PDF to text" tools fall short. They give you raw text โ a wall of characters in reading order. To get structured data (invoice number in one field, total in another), you need a second step: field detection.
Field detection maps the extracted text to known invoice fields. There are two approaches:
Template-based extraction
You define the layout of each supplier's invoice: "invoice number is always at coordinates (x=450, y=120)." This works perfectly for a single supplier but breaks when the layout changes โ a new template version, a different address, a different paper size.
AI-based extraction
A machine learning model is trained on thousands of invoice layouts. It learns that "invoice number" is usually near a label like "Invoice No.", "INV#" or "Bill Number" โ regardless of where on the page that label appears. It generalises to invoices it has never seen before.
AI-based extraction handles layout variation that breaks templates. It also improves over time as more documents are processed.
What affects OCR accuracy on invoices?
Scan quality
| DPI | Expected accuracy | |-----|-------------------| | 150 | 85โ90% โ many errors | | 300 | 95โ97% โ usable | | 400โ600 | 97โ99% โ recommended |
300 DPI is the practical minimum. Most phone scanner apps produce 300โ400 DPI and are adequate.
Image alignment
A straight scan gives much better results than a rotated one. Good OCR engines correct rotation automatically, but extreme angles (more than 15ยฐ) reduce accuracy. Scan flat on a surface, not held at an angle.
Font type
Printed fonts (Times, Arial, Helvetica) are read at near-perfect accuracy. Decorative or handwritten fonts are significantly harder. Handwritten text in a printed invoice โ like a handwritten total or annotation โ will likely be missed.
Image noise
Folds, creases, coffee stains, and pencil marks all add noise. Pre-processing handles minor noise. Heavy physical damage may require manual correction.
Common OCR errors on invoices and how to catch them
| Error | Example | Why it happens | |-------|---------|----------------| | 0 / O confusion | INV0001 โ INVOO01 | Similar shape at low DPI | | 1 / I / l confusion | Qty: 1 โ Qty: I | Thin strokes look identical | | Decimal errors | 1,234.56 โ 1.234.56 | Thousands separator misread | | Date format errors | 01/02/2025 read as 1/2/25 | Leading zeros dropped | | Split numbers | 10,000 split across columns | Table column boundary wrong |
A well-designed invoice tool shows confidence indicators next to each extracted field โ so you know exactly which values to double-check without reading everything.
How ClearDocs handles invoice OCR
ClearDocs uses a two-stage pipeline:
-
Text extraction โ for digital PDFs, text is read directly (no OCR needed, so accuracy is 100% on the text layer). For scans and images, OCR is applied.
-
AI field detection โ the extracted text is passed to a field-detection model that identifies invoice_number, invoice_date, vendor_name, line_items, total, and all other standard fields.
Extracted fields are shown with confidence indicators. Fields where the model is uncertain appear with a dashed border so you know where to look first.