BarCodeReader

BarCodeReader class

BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes.

new BarCodeReader(image, areas, decodeTypes)

Initializes a new instance of the BarCodeReader

ParameterDescription
imageencoded as base64 string or path to image
areasarray of object by type Rectangle
decodeTypesthe array of objects by DecodeType

Example:

//This sample shows how to detect Code39 and Code128 barcodes.
let reader = new BarCodeReader("test.png", null,  [DecodeType.CODE_39, DecodeType.CODE_128]);
let results = reader.readBarCodes();
for(let i = 0; i < results.length; i++)
{
   let result = results[i];
   console.log("BarCode Type: " + result.getCodeTypeName());
   console.log("BarCode CodeText: " + result.getCodeText());
}

Methods

NameDescription
importFromXml(xmlFile) (static)Exports BarCode properties to the xml-file specified
containsAny()Determines whether any of the given decode types is included into
exportToXml(xmlFile)Exports BarCode properties to the xml-file specified
getBarCodeReadType()Gets the decode type of the input barcode decoding
getBarcodeSettings()The main BarCode decoding parameters. Contains parameters which make influence on recognized data.
getFoundBarCodes()Gets recognized BarCodeResult array
getFoundCount()Gets recognized barcodes count
getQualitySettings()QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by em
getTimeout()Gets the timeout of recognition process in milliseconds.
readBarCodes()Reads BarCodeResult from the image.
setBarCodeImage(imageResource, …areas)Sets bitmap image and areas for recognition. Must be called before ReadBarCodes() method.
setBarCodeReadType(…types)Sets SingleDecodeType type array for recognition. Must be called before readBarCodes() method.
setQualitySettings()QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by em
setTimeout(value)Sets the timeout of recognition process in milliseconds.