Adobe 0046100128056 Scripting Guide - Page 61
Converting item shapes, IntersectPath, MinusBack, and SubtractPath.
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 61 highlights
CHAPTER 5: Working with Page Items Duplicating and Moving Page Items 61 item supports the following methods related to the Pathfinder features: AddPath, ExcludeOverlapPath, IntersectPath, MinusBack, and SubtractPath. All of the Pathfinder methods work the same way--you provide an array of page items to use as the basis for the operation (just as you select a series of page items before choosing the Pathfinder operation in the user interface). Note that it is very likely that the type of the object will change after you apply one of the Pathfinder operations. Which object type it will change to depends on the number and location of the points in the path or paths resulting from the operation. To merge two page items into a single page item, for example, you would use something like the approach shown in the following fragment (for the complete script, refer to AddPath). //Given a rectangle "myRectangle" and an Oval "myOval"... myRectangle.addPath(myOval); The excludeOverlapPath method creates a new path based on the non-intersecting areas of two or more overlapping page items, as shown in the following script fragment (for the complete script, refer to ExcludeOverlapPath). //Given a rectangle "myRectangle" and an Oval "myOval"... myRectangle.excludeOverlapPath(myOval); The intersectPath method creates a new page item from the area of intersection of two or more page items, as shown in the following script fragment (for the complete script, refer to IntersectPath). //Given a rectangle "myRectangle" and an Oval "myOval"... myRectangle.intersect(myOval); The minusBack method removes the area of intersection of the back-most object from the page item or page items in front of it, as shown in the following script fragment (for the complete script, refer to MinusBack). //Given a rectangle "myRectangle" and an Oval "myOval"... myRectangle.minusBack(myOval); The subtractPath method removes the area of intersection of the frontmost object from the page item or page items behind it, as shown in the following script fragment (for the complete script, refer to SubtractPath). //Given a rectangle "myRectangle" and an Oval "myOval"... myOval.subtractPath(myRetangle); Converting page-item shapes InDesign page items can be converted to other shapes using the options in the Object > Convert Shape menu or the Pathfinder panel (Window > Object and Layout > Pathfinder). In InDesign scripting, page items support the convertShape method, as demonstrated in the following script fragment (for the complete script, refer to ConvertShape). //Given a rectangle "myRectangle"... myRectangle.convertShape(ConvertShapeOptions.convertToRoundedRectangle); The convertShape method also provides a way to open or close reverse paths, as shown in the following script fragment (for the complete script, refer to OpenPath).