Dev Center
Table of contents

JavaScript API Reference - Global Interfaces

Interface Description
BarcodeReaderException Exceptions raised for Barcode Reader errors.
FurtherModes Stores additional modes.
LocalizationResult Stores the localization result of the detected barcode.
Region Stores the barcode region information.
RuntimeSettings Stores the barcode reading runtime settings.
TextResult Stores the decoded barcode text results.

BarcodeReaderException

Exceptions raised for Barcode Reader errors.

Properties

Property Type Description
Error ErrorConstructor  
codeoptional EnumErrorCode The error code.
message string Error message describing the current exception inherited from Error.message.
name string Error name of the current exception inherited from Error.name.
stackoptional string Call stack at the time the current exception was thrown inherited from Error.stack.

FurtherModes

Stores the FurtherModes.

Properties

Property Type Description
barcodeColourModes BarcodeColourMode Sets the mode and priority for the barcode colour mode used to process the barcode zone.
barcodeComplementModes BarcodeComplementMode Sets the mode and priority to complement the missing parts in the barcode.
colourClusteringModes ColourClusteringMode Sets the mode and priority for colour categorization.
colourConversionModes ColourConversionMode Sets the mode and priority for converting a colour image to a grayscale image.
deformationResistingModes DeformationResistingMode Sets the mode and priority for deformation resisting.
dpmCodeReadingModes DPMCodeReadingMode Sets the mode and priority for DPM code reading.
grayscaleTransformationModes GrayscaleTransformationMode Sets the mode and priority for the grayscale image conversion.
imagePreprocessingModes ImagePreprocessingMode Sets the mode and priority for image preprocessing algorithms.
regionPredetectionModes RegionPredetectionMode Sets the region pre-detection mode for barcodes search.
textAssistedCorrectionMode TextAssistedCorrectionMode Sets the mode of text assisted correction for barcode decoding.
textFilterModes TextFilterMode Sets the mode and priority for text filter.
textureDetectionModes TextureDetectionMode Sets the mode and priority for texture detection.

LocalizationResult

Stores the localization result of the detected barcode.

Properties

Property Type Description
angle number The angle of a barcode. Values range from 0 to 360.
x1 number The X coordinate of the left-most point.
x2 number The X coordinate of the second point in a clockwise direction.
x3 number The X coordinate of the third point in a clockwise direction.
x4 number The X coordinate of the fourth point in a clockwise direction.
y1 number The Y coordinate of the left-most point.
y2 number The Y coordinate of the second point in a clockwise direction.
y3 number The Y coordinate of the third point in a clockwise direction.
y4 number The Y coordinate of the fourth point in a clockwise direction.

:+1: Tips and Tricks

  • The left-most corner of the barcode is the starting point (x1, y1). The following corner points (x2, y2), (x3, y3), (x4, y4) will be returned in the clockwise direction.

Barcode coordinates

Region

Stores the region information.

Properties

Property Type Default Value Description
regionBottom number 0 The bottom-most coordinate or percentage of the region.
regionLeft number 0 The left-most coordinate or percentage of the region.
regionRight number 0 The right-most coordinate or percentage of the region.
regionTop number 0 The top-most coordinate or percentage of the region.
regionMeasuredByPercentage number | boolean 0 Set measure of region by percentage or coordinate.
0 by coordinate
1 by percentage

RuntimeSettings

Stores the barcode reading runtime settings. These settings control the barcode recognition process.

Properties

Property Type Default Value Description
barcodeFormatIds number BF_ALL (-32505857) The selected barcode formats to be read from group 1 of 2.
barcodeFormatIds_2 number BF2_NULL (0) The selected barcode formats to be read from group 2 of 2.
barcodeZoneMinDistanceToImageBorders number BarcodeReader: 0
BarcodeScanner: 0
Sets the minimum distance (in pixels) between the barcode zone and image borders.
Value range: [0, 0x7fffffff]
binarizationModes EnumBinarizationMode[] [BM_LOCAL_BLOCK, BM_SKIP, BM_SKIP, BM_SKIP, BM_SKIP, BM_SKIP, BM_SKIP, BM_SKIP] The mode and priority for binarization.
deblurLevel1 number BarcodeReader: 9
BarcodeScanner: 0
deprecated The degree of blurriness of the barcode.
Value range: [0, 9]
deblurModes EnumDeblurMode[] [DM_SKIP, DM_SKIP, DM_SKIP, DM_SKIP, DM_SKIP, DM_SKIP, DM_SKIP, DM_SKIP, DM_SKIP, DM_SKIP] Sets the mode and priority for deblurring.
expectedBarcodesCount2 number BarcodeReader: 512
BarcodeScanner: 0
The number of barcodes expected to be detected for each image.
Value range: [0, 0x7fffffff]
furtherModes strong   Additional modes.
intermediateResultSavingMode EnumIntermediateResultSavingMode IRSM_MEMORY (1) The mode for saving intermediate result.
intermediateResultTypes EnumIntermediateResultType IRT_NO_RESULT (0) The types of intermediate result to be kept for further reference.
localizationModes number[] BarcodeReader: [LM_CONNECTED_BLOCKS, LM_SCAN_DIRECTLY, LM_STATISTICS, LM_LINES, LM_SKIP, LM_SKIP, LM_SKIP, LM_SKIP]
BarcodeScanner: [LM_CONNECTED_BLOCKS, LM_SKIP, LM_SKIP, LM_SKIP, LM_SKIP, LM_SKIP, LM_SKIP, LM_SKIP]
The mode and priority for localization algorithms.
minBarcodeTextLength3 number 0 The range of barcode text length for barcodes search.
Value range: [0, 0x7fffffff]
minResultConfidence4 number 0 The minimum confidence of the result.
Value range: [0, 100]
region Region   The barcode region definition.
resultCoordinateType number RCT_PIXEL (1) The format for the coordinates returned.
returnBarcodeZoneClarity number 0 Whether to report the clarity of the barcode zone.
Value range: [0, 1]
scaleDownThreshold5 number BarcodeReader: 100000
BarcodeScanner: 2300
The threshold for the image shrinking.
Value range: [512, 0x7fffffff]
scaleUpModes EnumScaleUpMode[] [SUM_AUTO, SUM_SKIP, SUM_SKIP, SUM_SKIP, SUM_SKIP, SUM_SKIP, SUM_SKIP, SUM_SKIP] The mode and priority to control the sampling methods of scale-up for linear barcode with small module sizes.
terminatePhase6 EnumTerminatePhase TP_BARCODE_RECOGNIZED (32) The phase where the algorithm stops.
textResultOrderModes EnumTextResultOrderMode[] [TROM_CONFIDENCE, TROM_POSITION, TROM_FORMAT, TROM_SKIP, TROM_SKIP, TROM_SKIP, TROM_SKIP, TROM_SKIP] The mode and priority for the order of the text results returned.
timeout number BarcodeReader: 100000
BarcodeScanner: 10000
The maximum amount of time measured in ms to be spent searching for a barcode per page. It does not include the time taken to load/decode an image from disk into memory.
Value range: [0, 0x7fffffff]

:+1: Tips and Tricks

  • 1 : If you have a blurry image, you can set deblurLevel to a larger value. The higher the value, the more effort the library will spend to decode images, but it may also slow down the recognition process.

  • 2 : Setting expectedBarcodesCount to 0 represents an “unknown” count and the library will try to find at least one barcode. 1 will result in trying to find exactly one barcode. Once a barcode is found, the library will stop the localization process and perform barcode decoding. n means the library will try to find n barcodes. If the library only finds m where m < n barcode(s), it will try a different localization algorithm until n barcodes are located, or all algorithms are tried.

  • 3 : 0 means no limitation on the barcode text length.

  • 4 : 0 means no limitation on the result confidence.

  • 5 : If the shorter edge size is larger than the given threshold value, the library will calculate the required height and width of the barcode image and shrink the image to that size before localization. Otherwise, the library will perform barcode localization on the original image.

  • 6 : When the recognition result is not desired, you can set this parameter to skip certain processing stages.

  • coverage is the default setting for BarcodeReader and speed for BarcodeScanner. See updateRuntimeSettings

TextResult

Stores the decoded barcode text results.

Properties

Property Type Description  
barcodeBytes number[] Barcode result content in a byte array.  
barcodeFormat number EnumBarcodeFormat The barcode format.
barcodeFormatString string Barcode type as a string.  
barcodeText string The barcode result text.  
localizationResult LocalizationResult The corresponding localization result.  
exception Exception License exception information.  

Exception

Stores exception code and message in case of a license exception.

Property Description
code Exception code
message Exception message

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version(10.0.21)
  • Version 10.x
    • Version 10.0.20
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.33
    • Version 9.6.32
    • Version 9.6.31
    • Version 9.6.30
    • Version 9.6.21
    • Version 9.6.20
    • Version 9.6.11
    • Version 9.6.10
    • Version 9.6.2
    • Version 9.6.1
    • Version 9.6.0
    • Version 9.3.1
    • Version 9.3.0
    • Version 9.2.13
    • Version 9.2.12
    • Version 9.2.11
    • Version 9.0.2
    • Version 9.0.1
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.7
    • Version 8.8.5
    • Version 8.8.3
    • Version 8.8.0
    • Version 8.6.3
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.5
    • Version 8.2.3
    • Version 8.2.1
    • Version 8.2.0
    • Version 8.1.3
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +