DS Server

Javascript: PageCollection.getItemAtTextPosition Method

Method|Introduced in 28.0

Description

Gets the page at a certain text input position.

Syntax

<void> PageCollection.getItemAtTextPosition(<Number> textPosition, <RequestPageCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
textPosition

Specifies a zero-based text input position.

callback

Receives the page at a certain text input position.

errorCallback

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

Examples

The following example demonstrates PageCollection.getItemAtTextPosition in a practical document-editing workflow. It gets the page at a certain text input position.

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

TXTextControl.pages.getItemAtTextPosition(
    -1,
    function(page) {
        if (!page) {
            console.warn("No page was returned.");
            return;
        }
        
        console.log("get item at text position result:", page);
    },
    onTxError
);