Arranging Page Items; Transforming Page Items; Using The Transform Method - Adobe 0046100128056 - InDesign - Mac Manual

Javascript
Table of Contents

Advertisement

C
5: Working with Page Items
HAPTER
//Given a rectangle "myRectangle"...
myRectangle.convertShape(ConvertShapeOptions.convertToOpenPath);

Arranging page items

Page items in an InDesign layout can be arranged in front of or behind each other by adjusting their
stacking order within a layer, or can be placed on different layers. The following script fragment shows how
to bring objects to the front or back of their layer, and how to control the stacking order of objects relative
to each other (for the complete script, refer to StackingOrder).
//Given a rectangle "myRectangle" and an oval "myOval",
//where "myOval" is in front of "myRectangle", bring
//the rectangle to the front...
myRectangle.bringToFront();
When you create a page item, you can specify its layer, but you can also move a page item from one layer
to another. The item layeritemLayerItemLayer property of the page item is the key to doing this, as shown
in the following script fragment (for the complete script, refer to ItemLayer).
//Given a rectangle "myRectangle" and a layer "myLayer",
//send the rectangle to the layer...
myRectangle.itemLayer = app.Documents.item(0).layers.item("myLayer");
The stacking order of layers in a document can also be changed using the move move method of the layer
itself, as shown in the following script fragment (for the complete script, refer to MoveLayer).
//Given a layer "myLayer", move the layer behind
//the default layer (the lowest layer in the document
//is layers.item(-1).
myLayer.move(LocationOptionsafter, app.documents.item(0).layers.item(-1));

Transforming Page Items

Transformations include scaling, rotation, shearing (skewing), and movement (or translation). In scripting,
you apply transformations using the
and
shear

Using the transform method

The
transform
the transformation or series of transformations to apply to the object. A transformation matrix can contain
any combination of scale, rotate, shear, or translate operations.
The order in which transformations are applied to an object is important. Applying transformations in
differing orders can produce very different results.
To transform an object, you follow two steps:
1. Create a transformation matrix.
2. Apply the transformation matrix to the object using the
also specify the coordinate system in which the transformation is to take place. For more on
coordinate systems, see
transformation, or transformation origin. For more on specifying the transformation origin, see
"Transformation origin" on page
methods used in versions of InDesign prior to InDesign CS3 (5.0).
method requires a transformation matrix (
"Coordinate spaces" on page
method. This one method replaces the
transform
transformationMatrix
65. In addition, you specify the center of
66.
Transforming Page Items 62
) object that defines
method. When you do this, you
transform
,
,
resize
rotate

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs5

Table of Contents