Scripting Acrobat Distiller 7.0 - choose setting in script?

OS 10.3.9 Quark 6.5 Distiller 7.0

I have been creating PDFs from Quark documents by printing to a .ps file in a Distiller hot folder. It just occurred to me that Distiller is scriptable so I can just add a command for Distiller in my script instead of relying on a hot folder. I added this and it works great:


tell application "Acrobat Distiller 7.0"
activate
open PS_file_path as alias
end tell

My question is, if I have different scripts that require PDFs created with different Distiller settings (“Standard” as opposed to “High Quality Print” for example), is there a way to specify which setting to use in the script? The dictionary makes it seem possible although I can’t figure it out from there. Seems like you should be able to use the “Distill” command instead of “Open”. Here is what the Acrobat dictionary says. Anyone have any ideas??

Distill reference – the object for the command
[destinationPath Unicode text] – Optional POSIX path to the output file (for example “/hello.pdf”). If desinationPath is not specified the PDF will be generated in the same folder as the source file.
sourcePath Unicode text – Required POSIX path to the input file (for example “/hello.ps”).
[adobePDFSettingsPath Unicode text] – Optional POSIX path to the Adobe PDF Settings file. If adobePDFSettingsPath is not specified the default is used (the one selected in the UI).

Model: Mac G5
Operating System: Mac OS X (10.3.9)

Hi Matt-Boy,

Give this a shot:


tell application "Acrobat Distiller 7.0"
	activate
	Distill sourcePath POSIX path of (path to home folder from user domain) & "Desktop/test.ps" destinationPath POSIX path of (path to home folder from user domain) & "Desktop/" adobePDFSettingsPath "/Library/Application Support/Adobe PDF/Settings/High Quality Print.joboptions"
end tell

CarbonQuark

I had sort of figured it out but I haven’t worked with POSIX path before so I had something a bit more awkward than what you have.

Thanks!

tell application "Acrobat Distiller 7.0"
launch
Distill sourcePath newpsfile adobePDFSettingsPath "/Library/Application Support/Adobe PDF/Settings/JOBOPTIONSFILEINHERE" destinationPath "Users/whereever/"
					end tell

set newpsfile as name of PS file to process
adobePDFSettingsPath must be the correct path from /

Matt-boy, I have long since stopped bothering with Acrobats watched folders. I use a similar system of a desktop folder with subs “in”, “out” , “logs” and all my Acrbat job.options. Then i just have the script generate strings for the files that should be produced. I then pass this on. Here is an example where im up to with this workflow. Im currently at a mental block with using Acrobat & JavaScript for the printing at the end but thats another story to which I may post and see if any body can help me with.

set Process_Folder to (path to desktop from user domain) & "Press PDF's:" as string
set PS_Folder to Process_Folder & "In:" as string
set PDF_Folder to Process_Folder & "Out:" as string
set Logs_Folder to Process_Folder & "Logs:" as string
-- Check for application processes and launch as quietly as possible
tell application "System Events"
	if not (exists process "Adobe Acrobat 7.0 Pr#2CB915") then
		launch application "Adobe Acrobat 7.0 Pr#2CB915"
	end if
	if not (exists process "Acrobat Distiller 7.0") then
		launch application "Acrobat Distiller 7.0"
		tell application "Acrobat Distiller 7.0"
			set miniaturized of front window to true
		end tell
	end if
end tell
-- Set up the front Quark document for printing to postscript files
tell application "QuarkXPress"
	activate
	set docName to name of document 1
	tell document 1
		set MyDocWidth to ((width of bounds of page 1) as millimeter units) as real
		set MyDocHeight to ((height of bounds of page 1) as millimeter units) as real
		tell print setup
			-- Layout
			set separation to false
			set print spreads to false
			set collate to false
			set include blank pages to true
			set print thumbnails to false
			set back to front to false
			set page sequence to all pages
			set registration marks to centered
			set registration marks offset to 8.504 -- Must be points value
			set tiling to off
			set absolute overlap to false
			-- Setup
			set printer type to "Adobe PDF"
			set paper size to "Custom" -- This needs to be set before setting the Height & Width
			set paper width to (MyDocWidth + 20) as millimeter units
			set paper height to (MyDocHeight + 20) as millimeter units
			set reduce or enlarge to "100%"
			set fit in area to false
			set page position to center position
			set orientation to portrait
			set paper offset to "0 pt"
			set page gap to "0 pt"
			-- Output
			set print colors to composite CMYK
			set resolution to "2400"
			set halftone screen to "400"
			-- Options (No Full resolution Tiff or Overprint EPS options)
			set flip horizontal to false
			set flip vertical to false
			set invert image to false
			set print quality to normal
			set data format to binary data
			set full res rotated objects to false
			-- Bleed
			-- set bleed to 3 as millimeter units (or use custom bleeds setup 1)
		end tell
		tell custom bleeds setup 1
			set EPS bleed type to symmetric
			set EPS bleed to 3 as millimeter units
			set bleed type to symmetric
			set bleed to 3 as millimeter units
			set bleed clipping to true
		end tell
		-- Check the images before printing. allow user to bailout of script
		set MissMod to count (every image whose modified is true)
		if MissMod > 0 then
			set Warning1 to display dialog "Warning you have " & MissMod & ¬
				" missing or" & return & "modified image(s) in your document!" buttons {"Cancel", "Print"} default button 1
			if button returned of Warning1 is "Print" then
			end if
		end if
		-- Check the colours used before printing. allow user to bailout of script
		set SpotSpec to count (every color spec whose separation is false)
		if SpotSpec > 0 then
			set Warning2 to display dialog "Warning you have " & SpotSpec & ¬
				" un-separated colour(s)" & return & "in your document!" buttons {"Cancel", "Print"} default button 1
			if button returned of Warning2 is "Print" then
			end if
		end if
		-- Create empty lists for later processes
		set PS_List to {}
		set PDF_List to {}
		try
			set pageCnt to count of pages
			-- Sequencial number pages starting from page 2 to end
			repeat with i from 2 to count of pages
				tell page i
					set fileNum to ""
					repeat until (length of (fileNum as text)) = (length of (pageCnt as text))
						if fileNum = "" then
							set fileNum to i - 1 -- Minus 1 from Quarks page numbering
						else
							set fileNum to "0" & fileNum
						end if
					end repeat
					-- Add file path string to list to be passed on to Distiller
					set FilePath to PS_Folder & docName & "_Page_" & fileNum & ".ps"
					copy (FilePath as string) to end of PS_List
					print PostScript file FilePath
					-- Add file path string to list to be passed on to Acrobat
					set FilePath to PDF_Folder & docName & "_Page_" & fileNum & ".pdf"
					copy (FilePath as string) to end of PDF_List
				end tell
				delay 15
			end repeat
			-- Number page 1 as last
			tell page 1
				-- Add file path string to list to be passed on to Distiller
				set FilePath to PS_Folder & docName & "_Page_" & pageCnt & ".ps"
				copy (FilePath as string) to end of PS_List
				print PostScript file FilePath
				-- Add file path string to list to be passed on to Acrobat
				set FilePath to PDF_Folder & docName & "_Page_" & pageCnt & ".pdf"
				copy (FilePath as string) to end of PDF_List
			end tell
		end try
	end tell
end tell
-- Allow postscript file to finish creating
delay 15
-- Process only files from Quark postscript list
tell application "Acrobat Distiller 7.0"
	repeat with j from 1 to pageCnt
		-- Dissiller requires POSIX (UNIX style) file path conversion
		Distill sourcePath POSIX path of ((item j of PS_List) as string) ¬
			destinationPath POSIX path of PDF_Folder ¬
			adobePDFSettingsPath POSIX path of (Process_Folder & "pass4press_v46.joboptions")
	end repeat
end tell
-- Record default printer and choose printer desination
tell application "Printer Setup Utility"
	set DefaultPrinter to the current printer
	set current printer to printer "DC_3535_DC3535_Print"
end tell
-- Process only files from Quark pdf list
repeat with aFile in PDF_List
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Adobe Acrobat 7.0 Pr#2CB915"
		activate
		open theFile -- with invisible
		tell active doc
			-- JavaScript indexing is zero based so minus 1
			set PageCount to (count of pages) - 1
			-- Set the print peramiters (JavaScript Only)
			set PP to "{binaryOK: true, bitmapDPI: 300, colorOverride: false, downloadFarEastFonts: true, fontPolicy: 0, gradientDPI: 150, pageHandling: 3, pageSubset: -3, printAsImage: false, printContent: 1, psLevel: 3, reversePages: false, transparencyLevel: 75, useT1Conversion: true}"
			-- Print document through JavaScript
			do script "this.print({bUI: false, bSilent: true, nStart: 0, nEnd: " & PageCount & ", printParams: " & PP & "});"
		end tell
		close active doc saving no
	end tell
end repeat
-- Set the printer back to default
tell application "Printer Setup Utility"
	set current printer to DefaultPrinter
end tell
-- Move any log files created by Distiller settings
tell application "Finder"
	try
		set Log_List to (files of (PDF_Folder as alias) whose name extension is "log") as alias list
	on error -- only one file
		set Log_List to (files of (PDF_Folder as alias) whose name extension is "log") as alias as list
	end try
	move Log_List to (Logs_Folder as alias)
end tell