DS Server

Javascript: TXTextControl.getPageUnit Method

Method|Introduced in 28.0

Description

Gets the measure used for page sizes and page margins.

Syntax

<void> TXTextControl.getPageUnit(<RequestMeasuringUnitCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the measure used for page sizes and page margins.

errorCallback

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

Examples

The following example demonstrates TXTextControl.getPageUnit in a practical document-editing workflow. It gets the measure used for page sizes and page margins.

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

TXTextControl.getPageUnit(
    function(unit) {
        if (!unit) {
            console.warn("No measuring unit was returned.");
            return;
        }
        
        console.log("get page unit result:", unit);
    },
    onTxError
);