Saturday, January 14, 2012
InDesign TextFrame object has a geometricBounds property. It looks like ... 10,15,30,115 .
This means top,left,bottom,right .
So if you want to convert this property value to java.awt.Rectangle , you have to write code under below .
def tfBounds = Eval.me('[ 10,15,30,115 ]')
int top = tfBounds[0] as Integer
int left = tfBounds[1] as Integer
int bottom = tfBounds[2] as Integer
int right = tfBounds[3] as Integer
int x = left
int y = top
int width = (right-left)
int height = (bottom - top)
println new java.awt.Rectangle( x,y,width,height )
$ groovy toAwtRectangle
java.awt.Rectangle[x=15,y=10,width=100,height=20]