Katie Floyd previously had a fabulous post on her blog detailing how to automatically OCR a PDF, using Hazel and PDFPen Pro. As her blog is no longer available I am sharing her wisdom here:
The first thing you need is a Hazel rule, how you set it up depends on your needs, this is mine:
The rule is very simple, it looks for anything that is a PDF, and runs an embedded AppleScript, documented below.
tell application "PDFpenPro" open theFile as alias tell document 1 ocr repeat while performing ocr delay 1 end repeat delay 1 close with saving end tell quit end tell
Full credit to David Sparks and Katie Floyd for originally providing the scripts and ideas!