← All posts

Converting a scanned PDF to Word: what to expect and what not to

A scan is a photo of the page, with no text inside. What OCR does when converting it to Word, where it works well, where it doesn't, and how to scan so it comes out better.

Hernán Díaz Rodríguez··4 min read

If you open a PDF and can't select the text with your mouse, it's a scan: every page is a picture. To the computer there are no letters, only coloured dots. Converting it to Word as is would give you one image per page, which you can't edit.

Getting the text out takes OCR (optical character recognition): a program that looks at the picture and works out which letters are there and where. Here's what our converter does with a scan, and what you can expect from the result.

How we know it's a scan

A page counts as scanned if it has no text and its images cover at least half of it. The other pages in the same PDF are converted the normal way: a document can mix text pages and scanned pages, and each gets what it needs.

What we do before reading

Handing the picture straight to the OCR engine (we use Tesseract, free and battle-tested) works worse than you'd think. So we prepare the page first:

The OCR then returns each word with its box. We place that text, invisible, over the page image in its exact spot. From there the page is converted like any PDF with text: paragraphs, columns, tables, with words where they were.

What works well

What not to expect

And a matter of time: OCR takes 5 to 10 seconds per page, and each conversion has a time limit. In very long scanned documents, pages there's no time for stay as images, and the result tells you so.

How to scan for better results

  1. 300 dpi on the scanner. More doesn't help much; less shows.
  2. Straight, whole page, no fingers or black edges.
  3. Greyscale for text; colour if photos matter. The "pure black and white" mode of some scanners eats thin strokes.
  4. On a phone, a scanning app that straightens the page beats the normal camera.

Do you really want Word?

Sometimes what you need isn't to edit but to search and copy text from a scan. There's a better option for that: OCR PDF. It keeps every page exactly as it was, with the original image, and lays the OCR text invisibly on top. It looks like the original and you can search, select and copy. If you need to change the content, then yes: PDF to Word.

Comments or ideas? Message me on LinkedIn. LinkedIn →