everyday mac tools

Make a scanned PDF searchable on a Mac

· 5 min read

A scanned PDF is a stack of pictures, and macOS has no built-in way to write a searchable text layer into it. Preview can recognize text on a scanned page while you look at it, so you can select and copy from a scan, but that recognition is not saved into the file. Spotlight, Command-F in other apps, and anyone you send it to are still looking at images. To make the file itself searchable you need OCR software that adds an invisible text layer under each page.

This post covers how to tell what you have, what macOS gives you for free, how to scan better next time, and what to check after OCR.

How to tell whether a PDF is scanned

  1. Open it in Preview and try to drag across a line of text. In a born-digital PDF the words highlight individually. In a scan, either nothing selects or a rectangle of the page selects as an image.
  2. Press Command-A, then Command-C, and paste into TextEdit. A scan produces nothing, or a page’s worth of Live Text if your macOS version recognizes it on the fly (more on that below).
  3. Tools, Show Inspector. The creator or producer field often names a scanner, a copier, or a phone scanning app. That is a strong hint.
  4. Look at the file size. Ten pages of text as a real PDF is usually well under a megabyte; ten scanned pages at 300 dots per inch is usually several.

A third case exists: a scan that already has a text layer, because whoever scanned it ran OCR. Command-F finds words in it and Select All produces text with the occasional misread character. If that is what you have, the file is already searchable and the rest of this post is about quality, not necessity.

What Live Text gives you, and what it does not

On recent versions of macOS, Preview and Quick Look recognize text in images as you view them. Point at a scanned page in Preview and the cursor may turn into a text cursor over the words; you can select, copy and look up. The same happens in Quick Look (select the file in Finder, press Space).

This is recognition on screen, not in the file. Close the window and it is gone. Nothing is written into the PDF, so:

  • Spotlight does not index the words.
  • Command-F in Preview may or may not find them depending on your version, and other apps will not.
  • The person you email it to gets pictures.
  • Automator’s Extract PDF Text action returns nothing for those pages.

Live Text is a good way to grab an address from a scan. It is not a way to make a document searchable.

Getting the text out without OCR software

If all you need is the words, not a searchable PDF, you can get them page by page with what is installed.

  1. Open the scan in Preview.
  2. On each page, drag to select the text with Live Text, or press Command-A if the whole page recognizes.
  3. Command-C, and paste into a TextEdit document.
  4. Repeat for each page.

For a few pages this is fine. For a report, it is an afternoon, and the result is a separate text file rather than a PDF you can search and cite by page. That gap is what OCR software fills.

Scan better before you scan more

The quality of OCR is set at the scanner, and a poor scan cannot be rescued afterwards.

  • 300 dots per inch for ordinary print. Lower and letters blur together; higher and the file grows without helping recognition.
  • Straight. Skewed pages recognize worse. Most scanner software has a deskew option; use it.
  • Grayscale or black and white for text. Color scans of black text are three times the size and no easier to read.
  • Flat and even. A shadow down the gutter of a book scan is a column of misreads.
  • One document per file. Recognition is fine either way, but searching and redacting are easier.

Scanning from an iPhone into a Mac works well for this: in Finder, right-click in a folder and choose Import from iPhone, then Scan Documents, and the phone’s camera flattens and crops each page for you. Notes has the same scanner. Either way, check the first page at full zoom before doing fifty more.

Add a text layer with OCR

OCR software reads each page image, works out what the letters are, and writes them into the PDF as invisible text positioned exactly over the printed words. The image stays as it was; the text sits underneath. Find, Spotlight, copy and citation all start working, and the page still looks like the scan.

Whatever tool you use, three things to expect from it. It should let you choose the language, because recognition is dictionary-assisted and a French letter run as English comes out wrong. It should keep the page image untouched rather than re-compressing it. And it should write a new file rather than altering the original, so you can compare the two.

Basalt has a Make Searchable tool that does this on your Mac, in a document engine that holds no network entitlement, so the scan never leaves the machine; the output is a new file and the original stays as it was. If the scan is also on its way to being redacted, doing OCR first means the redaction tool can find the words by search rather than by eye, and doing it in the same app means the text layer is one of the things the redaction destroys. Redacting photos and scans inside a PDF covers why that layer matters.

Check that it worked

  1. Command-F in Preview for a word you can see on page one, then for one on the last page.
  2. Command-A, Command-C, paste into TextEdit, and read a paragraph for misreads. A few are normal; a paragraph of nonsense means the scan was too poor, or the wrong language.
  3. In Terminal, after a minute for Spotlight to catch up: mdfind -onlyin ~/Documents "a distinctive word" and confirm the file is listed.
  4. Compare file sizes. A text layer adds a little; a large increase means the images were re-encoded, and Compress a PDF on a Mac without wrecking the scans is the next read.

Questions

Will OCR fix a blurry scan? No. It can only recognize what is legible. Rescan at 300 dots per inch, straight and evenly lit, then run OCR on the new file.

Can I make a searchable PDF from photos of pages? Yes, in two steps: get the photos into a PDF (Preview can open a set of images and export them as one PDF, or use the iPhone scanner above, which does the flattening), then run OCR on that PDF.

Does making a PDF searchable change how it prints? No. The text layer is invisible; the page image is what prints. If the printout looks different after OCR, the tool re-encoded the images, which is worth knowing before you use it on anything else.

The searchable PDF finds some words but not others. Recognition is only as good as the print. Faded headers, handwriting, stamps and very small type are the usual misses. If a specific word must be findable, check for it directly rather than assuming.