CHAPTER 3: Documents Basic Page Layout 37
undefined, {geometricBounds:[myDocument.documentPreferences.pageHeight+36,
marginPreferences.left, myDocument.documentPreferences.pageHeight + 144,
myRightMargin], contents:myString});
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);
Creating watermarks
You can apply watermarks to documents in InDesign or InDesign Server using scripting. Currently, no user
interface component exists in InDesign for managing watermarks.
A document’s watermark preferences can be set in two ways using scripting:
X Application-level watermark preferences, if any are set, are applied to the document watermark
preferences for each new document created by InDesign. This setting has no effect on existing
documents.
X Document-level watermark preferences apply only to that document. Setting or changing a
document’s watermark preferences replaces any previous watermark settings for the document.
Both the document and application watermark preference settings persist after the document or
application is closed until a script changes them.
The same group of watermark preferences exist for both the document and the application objects.
Setting watermark preferences
The following script fragment shows how to set watermarks at the application level. A watermark will be
applied to all documents created after this code finishes. (For the complete script for setting application
preferences, see ApplicationWatermark.)
app.watermarkPreferences.watermarkVisibility = true;
app.watermarkPreferences.watermarkDoPrint = true;
app.watermarkPreferences.watermarkDrawInBack = true;
app.watermarkPreferences.watermarkText = "Confidential";
app.watermarkPreferences.watermarkFontFamily = "Arial";
app.watermarkPreferences.watermarkFontStyle = "Bold";
app.watermarkPreferences.watermarkFontPointSize = 72;
app.watermarkPreferences.watermarkFontColor = UIColors.red;
app.watermarkPreferences.watermarkOpacity = 60;
app.watermarkPreferences.watermarkRotation = -45;
app.watermarkPreferences.watermarkHorizontalPosition =
WatermarkHorizontalPositionEnum.watermarkHCenter;
app.watermarkPreferences.watermarkHorizontalOffset = 0;
app.watermarkPreferences.watermarkVerticalPosition =
WatermarkVerticalPositionEnum.watermarkVCenter;
app.watermarkPreferences.watermarkVerticalOffset = 0;