RE: Paper Size in QX
RE: Paper Size in QX
- Subject: RE: Paper Size in QX
- From: "Wadson, David" <email@hidden>
- Date: Wed, 30 Jan 2002 11:54:39 -0500
I'm not sure the exact reason why, but I had trouble getting the paper size
option to change properly. The work around I used was to create two copies
of the PPD file for our laser printer - one for letter and on for tabloid
(the two sizes we always use). I removed all other paper size options from
the actual PPD file so that if I choose the Tabloid PPD, that's the only
size that is available and the page setup always uses that. Same thing for
the Letter PPD. Selecting a PPD file works reliably in a script but
specifying the paper size doesn't.
The following script code actually looks at the size of the document and
determines whether to print it out on Letter or Tabloid sized paper. The
PPD's are named "z_HP LaserJet-Letter" and "z_HP LaserJet-Tabloid". The page
height and width values are actually set for less than the standard 8.5x11
or 11x17 inches to accommodate for the printer being unable to image right
to the very edge of the paper. Also, if the document won't fit on tabloid
paper, it scales it down 72%. I could put a routine in there to calculate
exactly how much it should scale to fit the page but the majority of our
large documents require a 72% reduction so I just put in the static value. I
also have the script set the resolution, halftone screen, registration
marks, separations, colors as gray options and what not but I left those out
from the sample code below.
Given that I've had trouble getting the document to automatically print the
document, I left that out of my script. The user still has to choose print
and specify page range if necessary but the script still saves us a
tremendous amount of time. Having to use three keystrokes, one to call the
script, one to open the print dialog, and one to hit the OK button, is a
heck of a lot easier than having to choose the paper size, scaling, etc.
everytime you print something...
tell application "QuarkXPress(tm)"
tell front document
set pageWidth to (page width as inches) as real
set pageHeight to (page height as inches) as real
if pageWidth is greater than pageHeight then
set paperOrientation to "Landscape"
set tempVariable to pageWidth
set pageWidth to pageHeight
set pageHeight to tempVariable
else
set paperOrientation to "Portrait"
end if
if (pageWidth > 8.25) or (pageHeight > 10.65) then
set paperSize to "Tabloid"
else
set paperSize to "Letter"
end if
if (pageWidth > 10.65) or (pageHeight > 16.75) then
set pageScale to "72"
else
set pageScale to "100"
end if
set printerPPD to "z_HP LaserJet-" & paperSize
tell print setup
set printer type to printerPPD
if paperOrientation is "Portrait" then
set orientation to portrait
else
set orientation to landscape
end if
set reduce or enlarge to pageScale
end tell
end tell
end tell
----------
>
From: Alberto Salvagnini
>
Sent: Wednesday, January 30, 2002 11:20 AM
>
To: AppleScript Users
>
Subject: Paper Size in QX
>
>
Hi all,
>
>
Can someone tell me what is happening?
>
>
tell application "QuarkXPress"
>
get paper size of print setup of document 1
>
end tell
>
->"A3"
>
>
tell application "QuarkXPress"
>
set paper size of print setup of document 1 to "A3"
>
end tell
>
error -10006 (apple event write denied)
>
>
The paper size list is:
>
{
>
"US Letter",
>
"US Letter.Transverse",
>
"US Legal",
>
"Tabloid",
>
"TabloidExtra",
>
"12x17.3",
>
"A3",
>
"A4",
>
"A4.Transverse",
>
"B4"
>
}
>
>
Why I cannot set the paper size? If I can do that manually why not with a
>
script?
>
>
Thanks for help :)
>
>
Alberto
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.