Adobe 0046100128056 Scripting Guide - Page 27
Setting grid preferences, the following script fragment from the CreateGuides tutorial script
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 27 highlights
CHAPTER 3: Documents Basic Page Layout 27 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}); guides.add(undefined, {orientation:HorizontalOrVertical.horizontal, location:(myPageHeight - marginPreferences.bottom)}); //Place a guide at the vertical center of the page. guides.add(undefined, {orientation:HorizontalOrVertical.vertical, location:(myPageWidth/2)}); //Place a guide at the horizontal center of the page. guides.add(undefined, {orientation:HorizontalOrVertical.horizontal, location:(myPageHeight/2)}); } You also can create guides using the createGuides method on spreads and master spreads, as shown in the following script fragment (from the CreateGuides tutorial script): var myDocument = app.documents.add(); with (myDocument.spreads.item(0)){ //Parameters (all optional): row count, column count, row gutter, //column gutter,guide color, fit margins, remove existing, layer. //Note that the createGuides method does not take an RGB array //for the guide color parameter. createGuides(4, 4, "1p", "1p", UIColors.gray, true, true, myDocument.layers.item(0)); } Setting grid preferences To control the properties of the document and baseline grid, you set the properties of the gridPreferences object, as shown in the following script fragment (from the DocumentAndBaselineGrid tutorial script): var myDocument = app.documents.add(); //Set the document measurement units to points. myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points; myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points; //Set up grid preferences. with(myDocument.gridPreferences){ baselineStart = 56; baselineDivision = 14; baselineShown = true; horizontalGridlineDivision = 14; horizontalGridSubdivision = 5 verticalGridlineDivision = 14; verticalGridSubdivision = 5 documentGridShown = true; }