开发者

Applescript or Automator: Run Acrobat X Pro to batch OCR multiple PDF files, more

开发者 https://www.devze.com 2023-03-29 12:00 出处:网络
I\'m using a ScanSnap S1500M to scan all paper documents to the folder /PDF-scans/ – I\'d like to use Adobe Acrobat X Professional to OCR the text.

I'm using a ScanSnap S1500M to scan all paper documents to the folder /PDF-scans/ – I'd like to use Adobe Acrobat X Professional to OCR the text.

I'd like to automate this process (daily):

  • open Acrobat X Pro
  • batch OCR process PDF files in /PDF-scans/, append "-OCR" to filename
  • after OCR, move files to /PDF-ocr/
  • delete original PDF file开发者_运维百科s in /PDF-scans/

Should I use Automator? Is there a script that can do this? Does it have to be tied to iCal's repeating events?

Thank you.


I would download PDFPen which allows you to ocr documents easily. Once you've done that, you can use this script:

set the PDF_folder to "where:Ever:Your:PDF:folder:is:" as alias
set the OCR_folder to "/where/ever/you/want/the/new/folder/to/be" as POSIX file

tell application "Finder"
    repeat with this_PDF in (every item of the PDF_folder)
        my ocr(this_PDF)
    end repeat
end tell

on ocr(this_PDF)
    tell application "PDFpen"
        open this_PDF as alias
        tell document 1
            ocr --simple
            repeat while performing ocr
                delay 1
            end repeat
            delay 1
        end tell
        set this_PDF to (save document 1 in this_PDF)
        close document 1
    end tell
    tell application "Finder"
        if not exists OCR_folder then set the OCR_folder to (make new folder at (the OCR_folder as alias with properties {name:"ocr"})
        move this_PDF to the OCR_folder with replacing
    end tell
end ocr
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号