How to search for text inside PDF files on a Mac
macOS indexes the text inside your PDFs, so you can find a document by a phrase in it. The catch is scanned PDFs, which are pictures of pages and need one extra step.
Search every PDF at once
- Open a Finder window and press ⌘F.
- Choose This Mac, or stay in a folder to search only there.
- Type
kind:pdffollowed by your words, for examplekind:pdf "termination clause".
Quotes keep the words together as a phrase. Without them, Finder finds PDFs containing each word anywhere.
Spotlight does the same from ⌘Space, but shows only the top few matches.
Search within one PDF
- Open the PDF in Preview.
- Press ⌘F and type.
- Preview highlights every match and lists the pages in the sidebar. Press ⌘G to jump to the next one.
If you open several PDFs in one Preview window, the search runs across all of them.
Scanned PDFs
A scanned PDF is a set of images. It has no text for the index to read, so a phrase search may not find it.
- Check first: open it in Preview and try to select a word. On recent versions of macOS, Live Text lets you select text on scanned pages, which means you can read and copy it even though the file itself holds no text.
- To make it searchable for good, the PDF needs a text layer added by an OCR tool. Some scanner apps do this when they save. Look for a setting called "searchable PDF".
From Terminal
This lists PDFs in Documents whose contents mention "invoice":
mdfind -onlyin ~/Documents "kMDItemContentType == 'com.adobe.pdf' && kMDItemTextContent == '*invoice*'c"
The same search, with thumbnails
Gander uses the same index, so it finds words inside PDFs too, and you type the whole request in one go: pdfs with termination clause or pdfs with invoice from last month. Each match is shown as a thumbnail of its first page, which is often enough to recognise it.
It also helps when you cannot recall a phrase at all, only that the PDF arrived last week from an email: pdfs from gmail last week.
Scanned PDFs are the same story as above. If the file has no text layer, the index has nothing to match.
FAQ
Why can't my Mac find text that I know is in a PDF?
The PDF is probably a scan without a text layer, or it sits in a folder Spotlight does not index. Try selecting text in Preview to see which.
Can I search PDFs in a single folder only?
Yes. Open that folder in Finder, press Command-F, and click the folder's name next to "This Mac" at the top of the window.
Does Preview search handwritten notes?
Only where Live Text can read the handwriting, and it will not be as reliable as printed text.