Printing A Document; Printing Using Page Ranges; Setting Print Preferences - Adobe 27510753 - InDesign CS2 - PC Manual

Scripting guide
Hide thumbs Also See for 27510753 - InDesign CS2 - PC:
Table of Contents

Advertisement

96
Working with Documents in AppleScript

Printing a document

The following script prints the active document using the current print preferences:
--PrintDocument.as
--An InDesign CS2 AppleScript
--Prints the active document using the current print settings.
tell application "Adobe InDesign CS2"
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:
--PrintPageRange.as
--An InDesign CS2 AppleScript
--Prints a page range from the active document.
--The page range can be either all pages or a page range string.
--A page number in the page range must correspond to a page
--name in the document (i.e., not the page index). If the page name is
--not found, InDesign displays an error message.
tell application "Adobe InDesign CS2"
--Set up an example document.
set myDocument to make document
tell myDocument
set pages per document of document preferences to 10
set facing pages of document preferences to false
set myPageHeight to page height of document preferences
set myPageWidth to page width of document preferences
--Create a single-page master spread.
tell master spread 1
repeat while count pages > 1
end repeat
tell page 1
end tell
set vertical justification of text frame preferences of myTextFrame
set justification of paragraph 1 of myTextFrame to center align
set point size of character 1 of myTextFrame to 72
end tell
--End of example document.
set page range of print preferences to "1-3, 10"
print
end tell
end tell

Setting print preferences

The print preferences object contains properties corresponding to the options in the panels of the Print
dialog box. This example script shows how to set print preferences using scripting:
--PrintPreferences.as
--An InDesign CS2 AppleScript
--Sets the print preferences of the active document.
tell application "Adobe InDesign CS2"
--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
delete page -1
set myTextFrame to make text frame with properties
{geometric bounds:{0, 0, myPageHeight, myPageWidth},
contents:auto page number}
to center align
Adobe InDesign CS2 Scripting Guide
¬
¬
¬

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs2

Table of Contents