Skip to main content

Search text in PDF files.

# To find lines that match pattern in a PDF:
pdfgrep <pattern> file.pdf

# To include file name and page number for each matched line:
pdfgrep --with-filename --page-number <pattern> file.pdf

# To do a case insensitive search for lines that begin with "foo" and return the first 3 matches:
pdfgrep --max-count 3 --ignore-case '^foo' file.pdf

# To find pattern in files with a .pdf extension in the current directory recursively:
pdfgrep --recursive <pattern>

# To find pattern on files that match a specific glob in the current directory recursively:
pdfgrep --recursive --include '*book.pdf' <pattern>