Javascript: Line.getTextBounds Method
Description
Gets the bounding rectangle of the text belonging to the line.
Syntax
<void> Line.getTextBounds(<RequestRectangleCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the bounding rectangle of the text belonging to the line. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Line.getTextBounds in a practical document-editing workflow. It gets the bounding rectangle of the text belonging to the line.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function inspectTextBounds(line) {
line.getTextBounds(
function(rect) {
if (!rect) {
console.warn("No rectangle was returned.");
return;
}
console.log("get text bounds result:", rect);
},
onTxError
);
}