Most of the PDF documents embed plain text in a compressed format, hence Hazel might not be able to process such PDF files correctly without prior decompressing the text.
As a workaround you might use Applescript and tools such as "pdftotext", "Adobe Acrobat Standard/Professional", or "skim" to retrieve the text to process it further. (All the mentioned tools need to be installed on your Mac).
A possible Applescript implementation using pdftotext could look as following (searching for 'Hazel'):
- Code: Select all
set itemPath to quoted form of POSIX path of theFile
-- use grep -w 'Hazel' for word matching
set res to do shell script "/usr/local/bin/pdftotext " & (quoted form of itemPath) & " - | grep 'Hazel'"
return res is not equal to ""
I hope this helps.