I wrote the following AppleScript to open a PDF file and export is as PNG.
I am using Illustrator CS5.
The export command gets an error: Adobe Illustrator got an error: Can't get current document.
when it encounters the export command.
What is causing this and how do I fix it?
set inputFile to (choose file with prompt "Open PDF file to convert to PNG:") as text
set exportFile to inputFile & ".png"
tell application "Adobe Illustrator"
if not frontmost then activate
open inputFile as alias without dialogs
export current document to exportFile as PNG24 ¬
with options {class:PNG24 export options ¬
, resolution:300 ¬
, matte color:{red:0, green:0, blue:0}}
close current document saving no
end tell
Making the object larger worked to get the desired resolution. Thanks.
It appears that there is not way to script the options that appear on the PNG export dialog,
other than using something like UI Browser. For example I can not set the background
to white from transparent with the scripting options. Is this correct?
North America
Europe, Middle East and Africa
Asia Pacific