new BarcodeGenerator(encodeType, codeText)

BarcodeGenerator constructor.

Example

// This sample shows how to create and save a barcode image.
let encode_type = EncodeTypes.CODE_128;
let generator = new BarcodeGenerator(encode_type);
generator.setCodeText("123ABC");

Parameters

Name Type Optional Description

encodeType

 

 

Barcode symbology type. Use EncodeTypes class to setup a symbology

codeText

 

 

Text to be encoded.

Throws

BarcodeException

Methods

exportToXml(filePath)

Exports BarCode properties to the xml file specified

Parameter

Name Type Optional Description

filePath

 

 

The xml file

Throws

IOException

Returns

Whether or not export completed successfully. Returns True in case of success; False Otherwise

generateBarCodeImage(format) → String

Generate the barcode image under current settings. This sample shows how to create and save a barcode image.

Example

let generator = new BarCodeGenerator(EncodeTypes.CODE_128);
let image = generator.generateBarCodeImage(BarCodeImageFormat.GIF);

Parameter

Name Type Optional Description

format

BarCodeImageFormat

 

BarCodeImageFormat value (PNG, BMP, JPEG, GIF)

Returns

String base64 representation of image.

getBarcodeType()

Barcode symbology type.

getCodeText()

Text to be encoded.

getParameters()

Generation parameters.

Returns

BaseGenerationParameters

importFromXml(filePath)

Imports BarCode properties from the xml-file specified and creates BarcodeGenerator instance.

Parameter

Name Type Optional Description

filePath

 

 

The name of the file

Returns

BarcodeGenerator

instance

save(filePath, format)

Save barcode image to specific file in specific format.

Example

let generator = new BarCodeGenerator(EncodeTypes.CODE_128);
generator.save("file path", BarCodeImageFormat.GIF);

Parameters

Name Type Optional Description

filePath

String

 

Path to save to.

format

BarCodeImageFormat

 

BarCodeImageFormat value (PNG, BMP, JPEG, GIF)

setBarcodeType()

Barcode symbology type.

setCodeText()

Text to be encoded.