Adobe 27510753 Scripting Guide - Page 138
Printing using ranges, Setting print preferences, property of the document's
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 138 highlights
130 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide myRightSlug.parentStory.tables.add(); //Body text master text frame. var myRightFrame = textFrames.add(myDocument.layers.item("BodyText"), undefined, undefined, {geometricBounds:[marginPreferences.top, marginPreferences.left, myBottomMargin, myRightMargin], previousTextFrame:myLeftFrame}); } } //Add section marker text--this text will appear in the footer. myDocument.sections.item(0).marker = "Section 1"; //When you link the master page text frames, one of the frames sometimes becomes selected. Deselect it. app.select(NothingEnum.nothing, undefined); Printing a document The following script prints the active document using the current print preferences: //PrintDocument.jsx //An InDesign CS2 JavaScript //Prints the active document. app.activeDocument.print(); Printing using page ranges To specify a page range to print, set the pageRange property of the document's printPreferences object before printing: //PrintPageRange.jsx //An InDesign CS2 JavaScript //Prints a page range from the active document. //Assumes that you have a document open, that it contains a page named "22". //The page range can be either PageRange.allPages or a page range string. //A page number entered 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 will display an error message. app.activeDocument.printPreferences.pageRange = "22" app.activeDocument.print(false); Setting print preferences The printPreferences 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.jsx //An InDesign CS2 JavaScript //Sets the print preferences of the active document. with(app.activeDocument.printPreferences){ //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 Printer.postscriptFile. printer = "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). //ppd = "AGFA-SelectSet5000SF"; //If the printer property is set to Printer.postscript file, the copies //property is unavailable. Attempting to set it will generate an error. copies = 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. //collating = false;