Tools,

Search multiple PDFs at once, scans included

0 of 17

hits inside scans found by pdfgrep and rga

Make your scans searchable

34 or 35 of 51 hits without OCR

20 PDFs, 40 words, 51 known hits
Way Hits Seconds, 40 searches
pdfgrep 2.2.0 34 3.65
ripgrep-all (rga) 0.10.10 34 1.81
Spotlight, macOS 26.6 35 3.7
Recoll 1.43.0 35 0.11
rga plus our OCR adapter 51 4.84
Recoll with pdfocr = 1 51 0.14
OCRmyPDF, then pdfgrep 51 5.56
OCRmyPDF, then Spotlight 51 3.08
Our Actor's text, then rg 51 0.28

No way had a false hit, and every miss sat inside an image-only scan. Recoll and Spotlight also match file names, which found memo-takahashi.pdf.

pdfgrep, rga and Recoll ran in Docker on 2 CPUs, the rest on our Mac. The adapter row includes its one OCR pass.

A scan is a picture

pdfgrep, rga and Spotlight read the text layer, and a scanned page has none. Spotlight read 0 characters from our scanned receipt and 683 from a typed invoice.

Not sure which of your files are scans? Find out why a PDF is not searchable.

OCR the folder once, then any tool works

brew install ocrmypdf
cp -R ~/Documents ~/Documents-backup
find ~/Documents -name '*.pdf' -exec ocrmypdf --skip-text --jobs 2 -q {} {} \;

Afterward pdfgrep and Spotlight each found 51 of 51.

The loop rewrites every file, typed ones too, and our folder grew from 17 MB to 26 MB. Keep the backup until you have checked.

The OCR costs seconds, once

rga adapter
3.3 s
first search
Recoll
5.7 s
index with OCR
OCRmyPDF
39.6 s
20 files, 2 jobs
Our Actor's code
42.2 s
20 files, our Mac

rga and Recoll keep the OCR text in their own cache or index. Our test folder was read only.

rga reads scans with our adapter

brew install ripgrep-all poppler tesseract
curl -fsSL -o "$(brew --prefix)/bin/pdf-ocr-text.sh" https://brasspage.com/search-multiple-pdfs/pdf-ocr-text.sh
chmod +x "$(brew --prefix)/bin/pdf-ocr-text.sh"
mkdir -p ~/Library/Application\ Support/ripgrep-all
curl -fsSL -o ~/Library/Application\ Support/ripgrep-all/config.jsonc https://brasspage.com/search-multiple-pdfs/rga-config.jsonc
rga -i "Okafor" ~/Documents

rga 0.10.10 has no OCR of its own. Our adapter runs Tesseract on pages with no text, and rga caches the result.

Recoll on Linux, with OCR on

sudo apt install recollcmd tesseract-ocr
mkdir -p ~/.recoll
printf 'topdirs = ~/Documents\npdfocr = 1\n' > ~/.recoll/recoll.conf
recollindex
recollq '"on Harbor Street"'

Put a phrase in double quotes, or Recoll matches the words anywhere in a file.

pdfgrep, for text layers only

brew install pdfgrep
pdfgrep -r -i -l "Okafor" ~/Documents
pdfgrep -r -i -n -P "on\s+Harbor\s+Street" ~/Documents

-l lists the files and -n adds page numbers. Run the OCR loop first, or it skips your scans.

Phrases that wrap to the next line

6 wrapped phrases, 10 hits, every way with OCR
Way Found
pdfgrep or rga, typed as is 0
pdfgrep -P, \s+ between words 10
rga -U, \s+ between words 0
rga -U, adapter with no page labels 10
Recoll, phrase in quotes 10
Recoll, no quotes 10, plus 3 false
Spotlight, after OCRmyPDF 9, plus 1 false
Our Actor's text, rg typed as is 10

rga starts each line with "Page 1:", so \s+ cannot cross the break. End the adapter's output_path_hint in .txt and it finds them, but the page numbers go.

No installs? Try our Actor

Our Apify Actor turns scanned PDFs into Markdown, with no server. Its text joins lines that wrap, so rg found every word and every phrase, typed as is.

The free plan takes 20 pages a run, 50 a month. A scanned page costs $0.006, and pages with a text layer are free.

Try the Actor

How I tested it
  • 20 PDFs in nested folders: 6 with a text layer, 7 image-only scans, 7 scans with an OCR layer from OCRmyPDF 17.13.0.
  • 14 are made-up office papers (the scans are simulated). 6 hold 10 real, proofread book pages from English Wikisource.
  • 40 words: client names, reference numbers, parts and book words. A hit is a file that holds the word, any case, as a whole word.
  • Docker rows: Debian 13 packages and the rga 0.10.10 release, 2 CPUs. Mac rows: Apple silicon, macOS 26.6, ripgrep 15.2.0.
  • Seconds are the first round of 40 searches, one after another. Spotlight was searched 1 and 6 minutes after the copy: 35 both times.
  • Our Actor's code at commit 5c8f91b0 (build 0.1.100), Markdown, language eng, on our Mac. No Apify run.
  • pdfgrep is GPL-2.0 or later, ripgrep-all AGPL-3.0 or later, Recoll GPL, OCRmyPDF MPL-2.0. We ran them and ship none of their code.
What I did not test

Windows File Explorer, Acrobat Reader's Advanced Search, Recoll's Mac and Windows builds, DocFetcher, encrypted PDFs, text that is not English, handwriting, and folders with thousands of files.

Questions people ask

How do I search multiple PDFs at once?

Point one tool at the folder: pdfgrep -r, rga, Recoll or Spotlight. As they come, they found 34 or 35 of our 51 hits, and every miss was inside a scan. With OCR, each way found all 51.

Why does search skip some of my PDFs?

Those pages are pictures with no text layer, so there is nothing to search. OCR adds the text.

Can Spotlight search scanned PDFs?

Not as we tested it on macOS 26.6. It found no words inside our image-only scans, even 6 minutes later. After OCRmyPDF added a text layer, it found all 51 hits.

How do I search many PDFs for a phrase?

Allow a line break between the words: pdfgrep -P with \s+, or Recoll with the phrase in quotes. Typed as is, pdfgrep and rga found 0 of the 10 hits from 6 phrases that wrap.