DS Server

Javascript: BarcodeCollection.addWithMouse Method

Method|Introduced in 28.0

Description

Inserts a barcode with the built-in mouse interface. The barcode's size is determined through the end-user. A cross cursor indicates where the barcode can be inserted. Changing the document aborts the insertion process.

Syntax

<void> BarcodeCollection.addWithMouse(<BarcodeType> barcodeType, <string> text, <FrameInsertionMode> insertionMode, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
barcodeType

The barcode type.

text

The text the barcode should encrypt.

insertionMode

Specifies how the text flow is handled.

callback

Optional. Is called when the operation successfully started.

errorCallback

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

Examples

The following example demonstrates BarcodeCollection.addWithMouse in a practical document-editing workflow. It inserts a barcode with the built-in mouse interface. The barcode's size is determined through the end-user. A cross cursor indicates where the barcode can be inserted. Changing the document aborts the insertion process.

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

function addWithMouse(barcodeType) {
    TXTextControl.barcodes.addWithMouse(
        barcodeType,
        "Quarterly report",
        TXTextControl.FrameInsertionMode.AsCharacter,
        function() {
            console.log("add with mouse completed.");
        },
        onTxError
    );
}