Adobe 27510753 Scripting Guide - Page 125
Defining guides, guide
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 125 highlights
Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 117 //Create a new example document to demonstrate the change. var myDocument = app.documents.add(); myDocument.documentPreferences.pageHeight = "1p"; myDocument.documentPreferences.pageWidth = "6p"; //Reset the application default margin preferences to their former state. with (app.marginPreferences){ top = myY1; left = myX1 ; bottom = myY2; right = myX2; } Changing the pasteboard's appearance The pasteboard is an area that surrounds InDesign pages. You can use it for temporary storage of page items. You can change the size of the pasteboard and its color using scripting. The pasteboardColor property controls the color of the pasteboard in Normal mode; the previewBackgroundColor property sets the color of the pasteboard in Preview mode: //PasteboardPreferences.jsx //An InDesign CS2 JavaScript //Create a new document and change the size of the pasteboard. myDocument = app.documents.add(); with(myDocument.pasteboardPreferences){ //You can use either a number or a measurement string //to set the space above/below. minimumSpaceAboveAndBelow = "12p"; //You can set the pasteboard color to any of //the predefined UIColor enumerations... pasteboardColor = UIColors.white; previewBackgroundColor = UIColors.gray; //...or you can specify an array of RGB values //(with values from 0 to 255) //pasteboardColor = [0, 0, 0]; //previewBackgroundColor = [192, 192, 192]; } Using guides and grids Guides and grids make it easy to position objects on your document pages. Defining guides A guide in InDesign gives you an easy way to position objects on the pages of your document. Here's an example use of guides: //Guides.jsx //An InDesign CS2 JavaScript //Create a new document, add guides, and set guide properties. var myDocument = app.documents.add(); var myPageWidth = myDocument.documentPreferences.pageWidth; var myPageHeight = myDocument.documentPreferences.pageHeight; with(myDocument.pages.item(0)){ //Place guides at the margins of the page. guides.add(undefined, {orientation:HorizontalOrVertical.vertical, location:marginPreferences. left}); guides.add(undefined, {orientation:HorizontalOrVertical.vertical, location:(myPageWidth marginPreferences.right)}); guides.add(undefined, {orientation:HorizontalOrVertical.horizontal, location:marginPreferences. top});