How OCR Works: Turning Scanned Pages into Real Text

By PDF Go TeamPublished April 5, 2026Updated July 20, 20264 min read
On this page

A scanned page is, to a computer, just a grid of colored pixels — no different from a photo of a mountain. OCR (optical character recognition) is the pipeline that turns that pixel grid into actual text a computer can search, copy, and read aloud. Here's each real stage of that pipeline, not just "AI reads the page."

Stage 1: Preprocessing

Before any recognition happens, the image gets cleaned up:

  • Binarization — converting the image to pure black and white, removing gray noise from the scan so text edges are crisp.
  • Deskewing — correcting for a page that was scanned slightly rotated. Even a couple of degrees of tilt meaningfully hurts recognition accuracy if left uncorrected.
  • Noise removal — clearing scan artifacts (dust specks, shadows from a book's spine, bleed-through from the page behind).

Skip this stage or do it badly, and every later stage inherits the error — this is why scan quality (resolution, lighting, flatness) affects OCR accuracy more than almost any other factor.

Stage 2: Layout analysis and segmentation

The page gets broken down structurally, in order:

  1. Blocks — separating body text from headers, footers, captions, and figures.
  2. Lines — splitting each block into individual lines of text.
  3. Words and characters — splitting each line into individual words, then individual characters (or character-like segments, for scripts where characters connect).

This stage matters more than people expect: a two-column academic paper misread as one column produces a jumbled, out-of-order mess even if every individual character is recognized correctly. Layout analysis is what keeps "column 1, then column 2" instead of reading straight across both.

Stage 3: Recognition

This is the step most people picture when they hear "OCR" — actually identifying what each character is. Modern OCR does this with a neural network (commonly a CNN feeding into an LSTM, or a transformer-based model in newer systems) trained on millions of examples of rendered characters in different fonts, sizes, and conditions. Tesseract, the most widely used open-source OCR engine, is a good reference implementation if you want to see the architecture directly — it moved to an LSTM-based model in version 4 specifically to improve on the classical character-classifier approach.

The network outputs a probability distribution over possible characters for each segment, along with a confidence score — this confidence score is why some OCR tools can flag "I'm not sure about this word" rather than silently guessing.

Stage 4: Post-processing

Raw recognition output gets cleaned up using language context:

  • Dictionary and language-model correction — if the raw output is "modem" but the surrounding words and a language model strongly suggest "modern," it gets corrected. This is the main reason OCR on real sentences outperforms OCR on random character strings, even though the visual recognition step is identical.
  • Reflow — reconstructing paragraphs and reading order from the segmented lines, matching the original layout logic from stage 2.
  • Confidence flagging — surfacing words the system wasn't sure about, so a human reviewer knows exactly where to double-check for anything high-stakes (legal documents, medical records).

Why OCR quality varies so much between tools

Given the same input image, tools differ on:

  • Training data breadth — a model trained mostly on clean, modern printed English struggles more on old typefaces, non-Latin scripts, or dense mathematical notation.
  • Layout handling — multi-column pages, tables, and figures with captions are where cheap OCR implementations fall apart, even if plain single-column text looks fine.
  • On-device vs. cloud models — on-device OCR (like Apple's Vision framework on macOS) is fast and private but sized to run efficiently on a laptop; cloud-based OCR can afford a larger model, sometimes at the cost of an upload step.

How to actually test OCR quality yourself

Don't trust a features page — test it directly:

  1. Scan or find a real document with a known "hard" case for your field: dense math notation, a two-column layout, an old or unusual font, a slightly skewed scan.
  2. Run it through the OCR tool you're evaluating.
  3. Compare the output against the original, specifically checking: reading order (did columns get mixed up?), confusable characters (rn/m, 1/l/I, 0/O), and whether tables came out as a jumbled string or kept their structure.

A tool that handles clean, single-column, modern-font pages well but falls apart on your actual documents isn't useful for your actual documents — test against your real use case, not a demo PDF.

How PDF Go uses OCR

PDF Go runs on-device OCR (via Apple's Vision framework) when you open a scanned PDF, adding an invisible text layer so the page becomes searchable and usable by the AI features — without uploading the scan anywhere for that step. See How AI Understands PDFs for what happens to that extracted text next.

Frequently asked questions

What does OCR stand for?

Optical Character Recognition — the process of converting an image of text (like a scanned page) into actual, machine-readable text characters.

Why does OCR sometimes get words wrong?

Recognition works on individual characters or short sequences based on their visual shape, and shapes that look alike (rn vs m, 1 vs l vs I, 0 vs O) can be misread — especially at low scan resolution or with unusual fonts. Language modeling can correct many of these using context, but not all.

Does OCR work on handwriting?

General-purpose OCR is tuned for printed text and struggles with handwriting, since handwritten letterforms vary far more than printed fonts. Handwriting recognition is a related but distinct technology, usually needing models specifically trained on handwritten samples.

Does a scanned PDF need OCR to be searchable?

Yes. A scanned PDF is just an image of a page — there's no underlying text for a computer to search, select, or read until OCR extracts it and (usually) adds an invisible text layer behind the image so the original appearance is preserved but the text becomes selectable.

Related articles

How AI Understands PDFs: Embeddings, Chunking, and Retrieval ExplainedBest AI PDF Reader for Mac (2026)PDF Go Features Explained

Try PDF Go

A native Mac app for chatting with, summarizing, and marking up PDFs — free to start, no account required to try it.

Download for Mac — free