Quark & Pdfs

So - I have a problem that I haven’t been able to tackle. Let me start by saying I’m new to Applescript, having migrated to Mac from a PC. I work in a pre-press setting and I am trying to write a script that will, among other things that I can try and add later, print PDF’s straight from quark and then print that PDF to our local printer. The problem I’m having is I can’t seem to use our PDF settings & make Quark print the PDF. I’m so lost!

One idea is to have Applescript to tell application “Printer Setup Utility” to set your printer to “Adobe PDF 7.0” (or whatever version you have) and set the “PDF Options” to one of your saved Distiller settings ← I know this option is possible… at the moment I don’t have a solution.

You could try this script fo now and set your Distiller setting to save directly to the printer. I couldn’t find any Applescript support in the Quark dictionary for “Layout as PDF” under the “Export” menu.

Try this for now:

tell application "QuarkXPress"
	activate
	tell front document
		set CROPS to 0
		set CROPS_DIALOG to display dialog "Crops or No Crops?" buttons {"Cancel", "No Crops", "Crops"} with icon 1 default button 3
		if button returned of CROPS_DIALOG is "Crops" then set CROPS to 1
		set tool mode to drag mode
		set DOCUMENT_WIDTH to page width as number
		set DOCUMENT_HEIGHT to page height as number
		set DOCUMENT_WIDTH to DOCUMENT_WIDTH + CROPS
		set DOCUMENT_HEIGHT to DOCUMENT_HEIGHT + CROPS
		tell print setup
			-- PRINT SETUP SETTINGS 
			set printer type to "AdobePDF 7.0" -- change this to your Printer Description (PPD) name
			set paper size to "custom"
			set paper width to DOCUMENT_WIDTH
			set paper height to DOCUMENT_HEIGHT
			set paper offset to 0
			set page gap to 0
			set reduce or enlarge to "100%"
			set fit in area to false
			set page position to center position
			set orientation to portrait
			
			--PRINT DOCUMENT SETTINGS
			set separation to false
			set print spreads to false
			set include blank pages to false
			set print thumbnails to false
			set back to front to false
			set page sequence to all pages
			if button returned of CROPS_DIALOG is "Crops" then
				set registration marks to centered
			else
				set registration marks to off
			end if
			set bleed to ".5" -- change bleed here
			set tiling to off
			set data format to binary data
			
			--PRINT OUTPUT SETTINGS
			set print colors to composite CMYK
			set print quality to normal
			set resolution to 2540
			set halftone screen to 400
		end tell
	end tell
	
	set MY_NAME to (name of the front document) as text
	set THE_PATH to path to the desktop as text
	set PSFILE_PATH to (THE_PATH & MY_NAME & ".ps") as text
	print front document PostScript file PSFILE_PATH
	
end tell

tell application "Finder"
	set FILE_CHECK to false
	repeat until FILE_CHECK is true
		if exists alias PSFILE_PATH then set FILE_CHECK to true
	end repeat
end tell

tell application "Acrobat Distiller 7.0" -- change this to your version
	activate
	open alias PSFILE_PATH
end tell

tell application "QuarkXPress"
	activate
	display dialog "Your PDF is on your desktop." buttons {"OK"} with icon 1 default button 1
end tell

CarbonQuark

so… i had something similar i was working on … i was getting stuck on the registration marks/crops thing… here’s the problem now… first time i try to run it, i get an error through distiller… i get all kinds of wonky symbols when it attemps to distill the file. if i cancel out, and run it again, it makes the PDF. so i quit, restarted distiller & quark, it made the pdf. deleted the pdf & postscript file … and it errored out again. its hit or miss, and i can’t figure it out.
when i open the print menu, it has all the settings & everything, which is awesome, it’s exactly what i was attempting to do, but for some reason was getting stuck.
anyhow. heres the error i get from distiller
the status says Distilling Page 1… and the percentage like -997, the -72, then 1929, 4536, 7424, 8578, 1005… catch my drift?

Acrobat Distiller 6.0.1
Started: Friday, February 3, 2006 at 2:32 PM
Adobe PostScript software version: 3015.102
CID support library initialization completed.

Distilling: brj022106-02-21-06.qxp-HR.ps
Start Time: Friday, February 3, 2006 at 2:33 PM
Source: /Users/Shared/Work/SaraWip/Preflight/scripts/brj022106-02-21-06.qxp-HR.ps
Destination: /Users/Shared/Work/SaraWip/Preflight/scripts/brj022106-02-21-06.qxp-HR.pdf
Adobe PDF Settings: /Users/Shared/Adobe PDF 6.0/Settings/HiRez PDF.joboptions
Distill Time: 15 seconds (00:00:15)
**** End of Job ****

Distilling: brj022106-02-21-06.qxp-HR.ps
Start Time: Friday, February 3, 2006 at 2:33 PM
Source: /Users/Shared/Work/SaraWip/Preflight/scripts/brj022106-02-21-06.qxp-HR.ps
Destination: /Users/Shared/Work/SaraWip/Preflight/scripts/brj022106-02-21-06.qxp-HR.pdf
Adobe PDF Settings: /Users/Shared/Adobe PDF 6.0/Settings/ HiRez PDF.joboptions
%%[ Error: rangecheck; OffendingCommand: colorimageDistiller ]%%

Stack:
4
true
{–currentfile-- /RunLengthDecode --filter–
(…)
–readstring-- --pop–}
{–currentfile-- /RunLengthDecode --filter–
(>??@@??>@@??>@?@??>?@???@@?>>?@@?>@??@@??@??@@??@@??@?@@>??@??@@???>>?@?@???@>>???>@??@?@??@??@??..)
–readstring-- --pop–}
{–currentfile-- /RunLengthDecode --filter–
(…)
–readstring-- --pop–}
{–currentfile-- /RunLengthDecode --filter–
(???>@>>>>@?@?>@>@??@?>??>??>@>?@@??>?>???@?>>>@??@A@>??>??@>@?>@@@@??>>?>@@???@?>@??@@@?>?@>@???>???>???@>>?@@?@?>@?@??>@???@@DHMRW[`eiotx}ÅÖäéìóõ £Ã
/RunLengthDecode
true

(…)
-save-

%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%

also - this script - along with the very very SIMPLE print scripts ive made for quark crash on my powerbook, which is running tiger. anyone know anything i can do for that?

If you are using Quark 6.5 on a Mac and calling on certain Quark Applescript commands (print) it will result in a crash. The “Script.xnt” file that ships with Quark 6.5 is the problem. Goto Quarks website and download “Output Enhancements XTensions software” in side that download there is a replacement “Script.xnt” file. This fixed a lot of the problems I was having with Quark and Applescript.

As far as your Distiller errors, it looks like one of your images might be corrupt or you are having a problem with a RGB conversion. Try eliminating elements or pages until you find the bad image. Open in Photoshop and save. This should correct the problem.

CarbonQuark

i’m just about ready to slap myself silly…i went back to make the pdf with a test quark doc… with cmyk boxes on it… no graphics… nothing. just colored boxes… it would only make the postscript… THEN… i looked at the code and the document width code was all screwed up - it says this: «class PWDT». so i moved over to my laptop, where i had the fresh script… and i get this error:

Can’t make «class PWDT» of document 1 of application “QuarkXPress Passport” into type number.

for this line of code:
set DOCUMENT_WIDTH to page width as number
and number is highlighted…

ugh!

slinkeepie,

The only way I was able to replicate your error was to run the script with no document open in Quark.

Do you have a document open when it executes this part of the script?

CarbonQuark

Ah, I just noticed something…

Do your application tells in your script reference “QuarkXPress Passport” or just “QuarkXPress”? Which do you have?

if you see this “«class PWDT»” it means it can’t find the applications Applescript library. Do you have Quark on the computer that you are running the script on? or maybe Script Editor was unable to locate it (try closing out of all applications, then launch Quark, then launch Script Editor).

CarbonQuark

I got the script up and running and totally customized to what i wanted it to do… ALL thanks to CarbonQuark - Thanks thanks thanks! round of applause!

Okay - now… I have an issue. I updated to Quark 7.0 … am i missing something? because even a simple simple script like this:

tell application “QuarkXpress”
activate
tell front document
print PostScript File alias
end tell
end tell

now… i tried to put a “to” after that to tell it where to go, but it doesn’t let me… i’m so new to this that i don’t know what i’m doing wrong and why.

nevermind.
i did something.
and it fixed it.
thanks for the help carbonQuark