TX Text Control .NET Server

Javascript: Line.getTextBounds Method

Method|Introduced in 28.0

Description

Gets the bounding rectangle of the text belonging to the line.

Syntax

<void> Line.getTextBounds(<RequestRectangleCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
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
    );
}