TX Text Control .NET Server

Javascript: Page.getTextBounds Method

Method|Introduced in 28.0

Description

Gets the bounding rectangle of the page's text, in twips, relative to the top of the document.

Syntax

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

Parameters

ParameterDescription
callback

Receives the bounding rectangle of the page's text, in twips, relative to the top of the document.

errorCallback

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

Examples

The following example demonstrates Page.getTextBounds in a practical document-editing workflow. It gets the bounding rectangle of the page's text, in twips, relative to the top of the document.

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

function inspectTextBounds(page) {
    page.getTextBounds(
        function(rect) {
            if (!rect) {
                console.warn("No rectangle was returned.");
                return;
            }
            
            console.log("get text bounds result:", rect);
        },
        onTxError
    );
}