How OCR works: from pixels to text
· How it works
OCR — optical character recognition — is the trick of turning a picture of writing into text a computer can use. Modern OCR is a neural pipeline, and a small one runs right inside your browser when ToPDF suggests a file name.
The pipeline
- Clean up: normalise lighting and contrast so strokes stand out (the enhancement you can see helps the OCR you can't).
- Find text regions and lines: the page is segmented — where are words, how do they group into lines.
- Read sequences: a neural network slides along each line and emits character probabilities, considering context (an ambiguous glyph between letters is probably a letter).
- Post-process: assemble words, apply domain rules — for passports, validate check digits; for cards, look for the name-above-birthdate pattern.
Why OCR still misreads
- Fancy fonts and handwriting stray far from training data.
- Low contrast/noise: the classic 0/O, 1/l/I, 5/S confusions bloom when strokes are faint.
- Layout chaos: stamps over text, tables, mixed scripts.
This fallibility is why ToPDF uses OCR only where a mistake is cheap and visible — a suggested file name you can overtype — and why documents themselves are kept as faithful images. (Image vs searchable PDFs.)
On-device OCR, specifically
Cloud OCR ships your text to a server; on-device OCR downloads a compact model once and reads locally. ToPDF bundles a general text model plus a specialist for passport machine-readable zones — both cached in your browser, both offline-capable, neither ever transmitting a character of your documents.
Frequently asked questions
Which languages does the name suggestion handle?
The reader targets Latin-script text (names on IDs and MRZs are Latin by international standard, even on multilingual cards). Non-Latin body text is simply left unread rather than mangled.
Can I get full-text OCR of my scans?
ToPDF deliberately stops at name suggestions. For searchable archives, run a local OCR tool over the PDFs — and keep privacy in mind if a tool is cloud-based.
Scan it now — free & private
Snap a photo, get a clean auto-cropped PDF in seconds. Everything runs in your browser — your documents never leave your device.
Open the scanner