Printing a Document. Adobe CS5 InDesign
Реклама
Реклама
C
HAPTER
3: Documents
Printing a Document 43 master page draws on the page. This is called the Master Page Overlay. When you select a page using the
Page Tool on the Tools Panel, you can see how the master page is positioned by checking the Show Master
Page Overlay checkbox on the control panel. You can move the overlay around with the mouse. InDesign achieves this by applying a transform to the master overlay matrix. Although the user interface allows only translation (moving x and y), you can do more by scripting. The following script shows how to transform a master page overlay. (For the complete script, see MasterPageTransform.)
--Given a document with four pages (1, 2, 3, 4)...
set myDocument to active document set myPages to pages of myDocument
--Rotate master page overlay around its top-left corner.
set myRotateMatrix to make transformation matrix with properties {counterclockwise rotation angle:27} set master page transform of item 1 of myPages to myRotateMatrix
--Scale master page overlay around its top-left corner.
set myScaleMatrix to make transformation matrix with properties {horizontal scale factor:0.5, vertical scale factor:0.5} set master page transform of item 2 of myPages to myScaleMatrix
--Shear master page overlay around its top-left corner.
set myShearMatrix to make transformation matrix with properties {clockwise shear angle:30} set master page transform of item 3 of myPages to myShearMatrix
--Translate master page overlay 1 inch right and 2 inches down.
set myTranslateMatrix to make transformation matrix with properties {horizontal translation:72, vertical translation:144} set master page transform of item 4 of myPages to myTranslateMatrix
Printing a Document
The following script prints the active document using the current print preferences. (For the complete script, see PrintDocument.) tell application "Adobe InDesign CS5" print active document end tell
Printing using page ranges
To specify a page range to print, set the page range
property of the document’s print preferences object before printing, as shown in the following script fragment (from the PrintPageRange tutorial script): tell application "Adobe InDesign CS5" set page range of print preferences to "1-3, 10" print end tell
Setting print preferences
The print preferences
object contains properties corresponding to the options in the panels of the Print dialog. This following script shows how to set print preferences using scripting. (For the complete script, see PrintPreferences.)
C
HAPTER
3: Documents
Printing a Document 44
--PrintPreferences.as
--An InDesign CS5 AppleScript
--Sets the print preferences of the active document.
tell application "Adobe InDesign CS5"
--Get the bleed amounts from the document's bleed and add a bit.
tell document preferences of active document set myX1Offset to document bleed inside or left offset + 3 set myY1Offset to document bleed top offset + 3 set myX2Offset to document bleed outside or right offset + 3 set myY2Offset to document bleed bottom offset + 3 end tell tell print preferences of active document
--Properties corresponding to the controls in the General panel
--of the Print dialog box.
--activePrinterPreset is ignored in this example--we'll set our
--own print preferences.
--printer can be either a string (the name of the printer) or
--postscript file.
set printer to postscript file
--Here's an example of setting the printer to a specific printer.
--set printer to "AGFA-SelectSet 5000SF v2013.108"
--If the printer property is the name of a printer, then the ppd property
--is locked (and will return an error if you try to set it).
try
--set PPD to "Device Independent" end try
--If the printer property is set to postscript file, the copies
--property is unavailable. Attempting to set it will generate an error.
--set copies to 1
--If the printer property is set to Printer.postscript file, or if the
--selected printer does not support collation, then the collating
--property is unavailable. Attempting to set it will generate an error.
--set collating to false set reverse order to false
--The setting of color output determines the settings available
--to almost all other properties in the print preferences.
try set color output to separations end try
--pageRange can be either PageRange.allPages or a page range string.
set page range to all pages set print spreads to false set print master pages to false
--If the printer property is set to postScript file, then
--the print file property contains the file path to the output file.
--set printFile to "yukino:test.ps" set sequence to all
--If trapping is on, setting the following properties
--will produce an error.
try if trapping is off then set print blank pages to false set print guides grids to false set print nonprinting to false end if end try
-----------------------------------------------------------------------
--Properties corresponding to the controls in the Setup panel of
--the Print dialog.
-----------------------------------------------------------------------
C
HAPTER
3: Documents
Printing a Document 45 set paper size to custom
--Page width and height are ignored if paper Size is not custom.
--set paper height to 1200
--set paper width to 1200 set print page orientation to portrait set page position to centered set paper gap to 0 set paper offset to 0 set paper transverse to false set scale height to 100 set scale width to 100 set scale mode to scale width height set scale proportional to true
--If trapping is on (application built in or Adobe inRip),
--attempting to set the following properties will produce an error.
if trapping is off then set thumbnails to false
--The following properties are not needed because thumbnails is set to false.
--set thumbnails per page to 4 set tile to false
--The following properties are not needed because tile is set to false.
--set tiling overlap to 12
--set tiling type to auto end if
-----------------------------------------------------------------------
--Properties corresponding to the controls in the Marks and Bleed
--panel of the Print dialog.
-----------------------------------------------------------------------
--Set the following property to true to print all printer's marks.
--set all Printer Marks to true; set use document bleed to print to false
--If use document bleed to print is true then setting any of the
-- bleed properties
--will result in an error.
set bleed bottom to myY2Offset set bleed top to myY1Offset set bleed inside to myX1Offset set bleed outside to myX2Offset
--If any bleed area is greater than zero, then export the bleed marks.
if bleed bottom is equal to 0 and bleed top is equal to 0 and ¬ bleed inside is equal to 0 and bleed outside is equal to 0 then set bleed marks to true else set bleed marks to false end if set color bars to true set crop marks to true set include slug to print to false set mark line weight to p125pt set mark offset to 6
--set mark Type to default set page information marks to true set registration marks to true
-----------------------------------------------------------------------
--Properties corresponding to the controls in the Output panel
--of the Print dialog.
----------------------------------------------------------------------set negative to true set color output to separations
--Note the lowercase "i" in "Builtin"
C
HAPTER
3: Documents
Printing a Document 46 set trapping to application builtin set screening to "175 lpi/2400 dpi" set flip to none
--If trapping is on, attempting to set the following properties
--will generate an error.
if trapping is off then set print black to true set print cyan to true set print magenta to true set print yellow to true end if
--Only change the ink angle and frequency when you want to override the
--screening set by the screening specified by the screening property.
--set black angle to 45
--set black frequency to 175
--set cyan angle to 15
--set cyan frequency to 175
--set magenta angle to 75
--set magenta frequency to 175
--set yellow angle to 0
--set yellow frequency to 175
--The following properties are not needed (because colorOutput
--is set to separations).
--set composite angle to 45
--set composite frequency to 175
--set simulate overprint to false
-----------------------------------------------------------------------
--Properties corresponding to the controls in the Graphics panel
--of the Print dialog.
----------------------------------------------------------------------set send image data to all image data set font downloading to complete try set download PPD fonts to true end try try set data format to binary end try try set PostScript level to level 3 end try
-----------------------------------------------------------------------
--Properties corresponding to the controls in the Color Management panel
--of the Print dialog.
-----------------------------------------------------------------------
--If the use color management property of color settings is false,
--attempting to set the following properties will return an error.
try set source space to use document set intent to use color settings set CRD to use document set profile to PostScript CMS end try
-----------------------------------------------------------------------
Изтегляне
Реклама