Javascript: TextFrame.getBounds Method
Description
Gets the frame's bounding rectangle relative to the upper left corner of the document.
Syntax
<void> TextFrame.getBounds(<RequestRectangleCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the current property value. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates TextFrame.getBounds in a practical document-editing workflow. It gets the frame's bounding rectangle relative to the upper left corner of the document.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function inspectBounds(textFrame) {
textFrame.getBounds(
function(rect) {
if (!rect) {
console.warn("No rectangle was returned.");
return;
}
console.log("get bounds result:", rect);
},
onTxError
);
}