TX Text Control .NET Server

Javascript: Barcode.saveImage Method

Method|Introduced in 28.0

Description

Saves the barcode image.

Syntax

<void> Barcode.saveImage(<ImageFormat> imageFormat, <RequestStringCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
imageFormat

Specifies the format used to save the image.

callback

Receives the image data as a base64 string.

errorCallback

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

Examples

The following example demonstrates Barcode.saveImage in a practical document-editing workflow. It saves the barcode image.

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

function saveImage(barcode) {
    barcode.saveImage(
        TXTextControl.ImageFormat.Bmp,
        function(result) {
            console.log("save image result:", result);
        },
        onTxError
    );
}