Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

Comments on Search tool for PDF content with verbatim text including special characters

Post

Search tool for PDF content with verbatim text including special characters

+3
−0

I'm looking for a free (and if possible opensource) tool to search through the content of PDFs.

Requirements:

  • search full text of all PDFs in one folder (the PDFs are "plain text", not scans)
  • show search result in the context of the lines around it
  • allow special characters in search like \begin{frame}<1-> or \defbeamertemplate* without having to escape them. I'm looking for exact matches and don't need fuzzy search etc.
  • works on macOS15

So far I've tried

DocFetcher

✅ search full text of all PDFs in one folder. Search index needs to be manually updated

✅ show search result in the context of the lines around it. Shows the full context including line breaks.

❌ allow special characters in search like \begin{frame}<1-> or \defbeamertemplate* without having to escape them

  • searching for \begin{frame}<1-> will cause an error, searching for "\begin{frame}<1->" will find false results like begin{frame} $1
  • searching for \defbeamertemplate* will give false results like \defbeamertemplate{block}

✅ works on macOS15

Recoll

✅ search full text of all PDFs in one folder. Update of search index can be automated, e.g. with a cron job

✅ show search result in the context of the lines around it. Shown unformatted context, line breaks are missing

❌ allow special characters in search like \begin{frame}<1-> or \defbeamertemplate* without having to escape them

  • searching for \begin{frame}<1-> will find false results like \begin{frame} 1
  • searching for \defbeamertemplate* will give false results like \defbeamertemplate{block}

✅ works on macOS15

rga

✅ search full text of all PDFs in one folder.

❌ show search result in the context of the lines around it. Only shows one line

❌ allow special characters in search like \begin{frame}<1-> or \defbeamertemplate* without having to escape them

  • searching for rga \begin{frame}<1-> /path/to/my/folder does not give any matches, don't know how I would need to escape this...
  • searching for rga defbeamertemplate\* /path/to/my/folder will give false results like \defbeamertemplate{block}

✅ works on macOS15

History

1 comment thread

Requirements (4 comments)
Requirements
Michael‭ wrote 11 months ago
  • Do you need OCR, or is the plain text expected to be recognizable?
  • Do you need links back to the content in the PDF, or would plaintext output with the context you specified be good enough?

If plain text is fine for both, I think anything people use for textconvert for PDFs in Git (or elsewhere) will work with normal grep.

samcarter‭ wrote 11 months ago · edited 11 months ago

I don't need OCR, the pdf's are "plain text". I need to know from which pdf the search result comes from.

Michael‭ wrote 11 months ago · edited 11 months ago

That does (for my skill level) eliminate direct piping, since grep won't know the file names. You could rig up a script, though, to

  1. iterate through the files
    1. make a local text file for each (foo.pdf.txt)
    2. grep the text file
    3. delete the text file
samcarter‭ wrote 11 months ago

Thanks for the suggestion. Let's see if somebody comes up with some ready-to-use software.