Copy link to clipboard
Copied
I have a textFrame a small number of graphicObjects that are grouped together. The text frame checks to see if it is part of a group and processes each of the graphic elements.
var parent = sign.textFrame.parent;
if (parent != undefined)
{
// see if this sign is part of a group then grap the other graphic elements
if (parent instanceof Group)
{
for (var i = 0; i < parent.allPageItems.length; i++)
{
var graphicItem = parent.allPageItems;
if (graphicItem instanceof Rectangle)
{
var saRectangle = new SARectangle(graphicItem);
this.rectangles.push(saRectangle);
}
else if (graphicItem instanceof GraphicLine)
{
var saLine = new SALine(graphicItem);
this.lines.push(saLine);
}
}
The SARectangle function is defined as:
function SARectangle (rectangle)
{
this.rotation = rectangle.absoluteRotationAngle;
logger.info("Rectangle: ")
boundsProperty = (rectangle.visible ? 'visible' : 'geometric') + 'Bounds';
var rect = rectangle[boundsProperty];
this.upperLeft = new SAPoint(rect[1], rect[0]);
this.lowerRight = new SAPoint(rect[3], rect[2]);
this.upperLeft.toPixels();
this.lowerRight.toPixels();
logger.info("upperLeft (" + rect[1] + "," + rect[0] + ") to upperLeft (" + upperLeft.x + "," + saUpperLeft.y + ")");
logger.info("lowerRight (" + rect[3] + "," + rect[2] + ") to upperLeft (" + upperLeft.x + "," + saUpperLeft.y + ")");
}
The problem is that the geometricBounds property does not seem to be defined! When the rect variable is assigned the error 'invalid object for this request' is thrown.
Any help would be appreciated.
A second time around looking at the problem allowed me to solve the issue.
Just check to see if the geometric bounds rectagle is defined then do the processing otherwise ignore it.
Copy link to clipboard
Copied
A second time around looking at the problem allowed me to solve the issue.
Just check to see if the geometric bounds rectagle is defined then do the processing otherwise ignore it.