Sumatra PDF is a PDF, ePub, MOBI, CHM, XPS, DjVu, CBZ, CBR reader for Windows

Find text from the command line

Can I search a particular word in a pdf file from the command-line, ie the same com Ctrl-f ?
/Fim

Hi, great app.
I read the command line arguments page and is there simply a way to do a text search from the command line?
Thanks,
Mark

Not sure whether he’s changed his mind in the last 5 years, but here’s the dev’s response:

I have uploaded my script that adds such use it is available to view here

And you can download from https://github.com/GitHubRulesOK/MyNotes/raw/master/AppNotes/SumatraPDF/LookInClass.cmd (beware the name may change) but name it “anything you like.cmd” NOT .TXT

Try it out so -find must be first choice ( or only choice) it will only find the first match after the point of entry so that could be the start of file or a given page or a named image location in a folder (It can go there but nothing to “find”:slight_smile: )
I does not work with PostScript files or HTTP type filenames as they are converted to local names so best to download then -search in the local files.

myFinder.cmd -find “Magic Mike” -page=20 example.pdf

Most likely results in a cryptic message, “The system cannot find the batch label specified - bummer”

What that really needs to show is that example.pdf was not found or badly specified
Let me know if it helps and I may tidy it up based on your testing

Things to try : the find option can be abbreviated to

-f "a multi word spaced out string"

the more unique it is the less likely to be found earlier than wanted however much more likely to NOT make a match without breaks.
Sometimes case can shift about without reason here I clearly asked for a phrase using Caps and lower case (not that it matters, there should be NO case difference in actions)
Lookinclass.cmd -f “Example Bibliography” F:\Data\Samples\epub\booksample.epub
The destination is shown that way but the sendkeys has decided to switch to upper case halfway through ! but on a second run does not ! ! (sendkeys is notorious for many odd effects)