DS Server

Javascript: RulerBarViewGenerator.getScaleUnit Method

Method|Introduced in 30.0

Description

Gets the scale unit of the ruler bar.

Syntax

<void> RulerBarViewGenerator.getScaleUnit(<RequestRulerBarScaleUnitCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the property value.

errorCallback

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

Examples

The following example demonstrates RulerBarViewGenerator.getScaleUnit in a practical document-editing workflow. It gets the scale unit of the ruler bar.

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

TXTextControl.rulerBar.getScaleUnit(
    function(scaleUnit) {
        if (!scaleUnit) {
            console.warn("No ruler bar scale unit was returned.");
            return;
        }
        
        console.log("get scale unit result:", scaleUnit);
    },
    onTxError
);