AppleScript to save pdf as pdf-x in Acrobat

吃可爱长大的小学妹 提交于 2019-12-13 00:09:25

问题


I am currently using Adobe Acrobat Pro DC 2015.23 on macOS Sierra. My goal is to create AppleScript that do such things:

  1. Open PDF File
  2. Save this file to pdf-x format
  3. Close file

I create AppleScript, that do all steps, but i can't find any documentation how to choose with PDF standard to use while saving.

If I want to do this manually I do following steps:

  1. Open PDF in Adobe Acrobat
  2. Choose PDF Standards Menu
  3. Click (Save as PDF/X)
  4. Press save

The question is how to set PDF/X standard while saving.

My script

on is_running(appName)
    tell application "System Events" to (name of processes) contains appName
end is_running

set theFiles to choose file with prompt "Select the files" of type {"pdf"} with multiple selections allowed

set aaRunning to is_running("Adobe Acrobat")

tell application "Adobe Acrobat"
    repeat with theFile in theFiles
        open theFile without dialogs
        save active doc to theFile
        close active doc
    end repeat
    if not aaRunning then
        quit
    end if
end tell

回答1:


As you may have noted, Applescript support of Acrobat is very limited.

Just so, the following possible workflows come to my mind:

a) you can use Preflight Profiles to create PDF/X (this is also the engine if you do it manually). You can run/apply Preflight Profiles using Acrobat JavaScript, and you can run Acrobat JavaScripts using the do script Applscript command.

b) you create a Preflight Droplet which makes an according PDF/X file. You then can use Applescript to open the document (file) in that droplet.

c) you use System Events to control the user interface elements of Acrobat. In other words, you do what you would do manually, but using System Events. You may want to use an utility, such as UI Browser to find the ways to address the various dialog elements.



来源:https://stackoverflow.com/questions/41714452/applescript-to-save-pdf-as-pdf-x-in-acrobat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!