pdfblah.com

← All guides

Search inside multiple PDFs at once

Ctrl+F works on the document you have open. The phrase you need is in one of the two hundred you don't. find is grep for PDFs: point it at files, a folder, or a whole tree, and every hit comes back as file, page, snippet.

How to do it

pip install pdfblah

# one folder
pdfblah find "termination clause" ~/contracts

# the whole tree
pdfblah find "INV-4471" ~/Documents -r

# grep-style muscle
pdfblah find "acme" ~/docs -r --ci --word
pdfblah find "INV-\d+" ~/docs -r --regex

Output is one line per hit, ready to click through:

contracts/2024/acme-msa.pdf p.7: ...either party may exercise the termination clause upon 30 days...
contracts/2024/acme-sow2.pdf p.2: ...the termination clause in section 9 applies...
2 match(es) in 214 file(s)

The part other tools skip

A scanned PDF has no text layer, so it can never match, and most search tools just stay quiet about it. find lists those files separately:

note: archive/lease-1998.pdf has no text layer (a scan?); run `pdfblah ocr` on it first

Run OCR on them once and they join every future search. Unreadable and encrypted files are listed too; a search that silently skips things is worse than no search.

Tips