如何在 PDF 文件中搜索一些文本

2 linux search pdf

我想在 PDF 文件中搜索一些文本。例如,我的 PDF 中的“go to”一词在哪里?如果找到了,那是什么页面?

我发现这个命令行:

find /TEMP -name 'manu.pdf' -exec pdftotext {} - \; | grep "go to"
Run Code Online (Sandbox Code Playgroud)

它产生了一些元素。

我想得到我的结果的页码。如何检索该项目?

小智 7

pdfgrep似乎做到了这一点。从手册页

-n, --page-number
Prefix each match with the number of the page where it was found.
Run Code Online (Sandbox Code Playgroud)