DS Server

Javascript: TextChar.getBounds Method

Method|Introduced in 28.0

Description

Gets the bounding rectangle of the character.

Syntax

<void> TextChar.getBounds(<RequestRectangleCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the bounding rectangle of the character.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates TextChar.getBounds in a practical document-editing workflow. It gets the bounding rectangle of the character.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectBounds(textChar) {
    textChar.getBounds(
        function(rect) {
            if (!rect) {
                console.warn("No rectangle was returned.");
                return;
            }
            
            console.log("get bounds result:", rect);
        },
        onTxError
    );
}