Is it possible to script the Export in PDF of a layout? I have Script Debugger 4 and have been trawling thru the dictonary and can’t find any references on PDF. When I search ‘PDF’ it sends me to “QuarkXpress Ancillary Objects” but I’m finding nothing in there about PDF!
Since the PDF filter is an Xtension, maybe it can’t be accessed via Applescript. Any comments?
Model: PowerPC G5
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)
As far as I know it’s not currently possible to script the “Export Layout as PDF.” menu item.
However, you can script the printing of a PS file saved to a Watched Folder and then have your Acrobat Distiller process it ito a PDF.
There are a number of threads on this in the Quark Apple Script forum. See, among others, the one below:
Reply if you need more info.
Thanks for the info!
In this case the PDF’s are only reference files and, AFAIK, not used for actual printing. So it would seem that running distiller just for that would be way overkill. But it is great to get a confirmation to my suspicions that it can’t (currently) be done.
Alanvee, if you script is only a very basic one you do have the option to use UI scripting to Export PDF to desktop. I use the watched folder and distiller route myself but i don’t know your requirements.
tell application "QuarkXPress"
tell application "System Events"
tell process "QuarkXPress"
tell menu bar 1
click menu item "Layout as PDF..." of menu " " of menu item "Export" of menu "File"
-- The following lines set the path to the desktop
key down command
key up command
Awesome idea! Had no clue you could interact with “System Events” that way - I’m such a newbie!
That SHOULD be the perfect solution for this as the PDF’s are just a reference copy of the current project with a custom time-stamp on them. Running Distiller for this seemed too heavy handed. Plus I don’t think they do THAT much Quark stuff anyway.
Or script distiller directly if you don’t want hot folders:
tell application "QuarkXPress"
--Do whatever you need to do before printing
--Print to a PS file in a folder called "PDF Folder" on the desktop
--using variable fileBase in this case as the file name
set PS_file_path to (PathToDesktop & "PDF Folder:" & fileBase & ".ps") as text
print front document PostScript file PS_file_path
close document myName saving no
tell application "Finder" --This will make sure the PS file is finiished before going to Distiller
repeat while not (exists file (PathToDesktop & "PDF Folder:" & fileBase & ".ps"))
tell application "Acrobat Distiller 7.0" --Distiller uses POSIX file paths
set POSIXPath2PSFile to POSIX path of (PS_file_path as alias)
set PathToStndDistill to POSIX path of (("Macintosh HD:Library:Application Support:Adobe PDF:Settings:Standard.joboptions") as alias) --you can change this to any setting you have in Distiller
Distill sourcePath POSIXPath2PSFile adobePDFSettingsPath PathToStndDistill
tell application "Finder" --make sure the PDF is done and delete the PS file
repeat while not (exists file (PathToDesktop & "PDF Folder:" & fileBase & ".pdf"))
delete file PS_file_path