Dynamsoft Barcode Reader SDK for JavaScript: upgrade from v7.1.3 to v7.2.2

This post is meant for users who are using version 7.x of the SDK in an web application running in browsers. If you are using version 6.x of the library or using the SDK in a Node.js application and  wish  to upgrade,  please contact Dynamsoft support.

Dynamsoft released v7.2.2 of Dynamsoft Barcode Reader SDK for JavaScript on Nov 27th. This edition has improved the accuracy of OneD barcode decoding and now provides two WASMs to cater to different usage scenarios. At the same time, it has implemented the latest algorithm that contains improvements made during the versions v7.2 ~v7.2.2. Check out the details here.

Updating Existing Code

For existing code that’s based on version 7.1.3 of the library. There are a few things to note when attempting to update to this new version.

Step One: Specify the new version when including the library.

If you are using the jsDelivr or UNPKG CDN, you must make sure you specify the version like this:

<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.2.2-v2/dist/dbr.js" data-productKeys="YOUR-LICENSE-KEY"></script>

or

<script src="https://unpkg.com/dynamsoft-javascript-barcode@7.2.2-v2/dist/dbr.js" data-productKeys="YOUR-LICENSE-KEY"></script>

If you deployed the SDK on your server (which is recommended for production), make sure you update the URL to correctly include the library. The distribution files for the latest version can be downloaded here.

Step Two: Update a few APIs

The following APIs are changed in version 7.2.2

  • EnumBarcodeFormat: this enumeration has been redefined. Lots of new formats are added and a prefix “BF_” is also added to each format. Make sure to update your code accordingly.
7.1.37.2.2
AZTEC: 268435456
All: 503318527
CODABAR: 8
CODE_39: 1
CODE_39_EXTENDED: 1024
CODE_93: 4
CODE_128: 2
DATAMATRIX: 134217728
EAN_8: 64
EAN_13: 32
INDUSTRIAL_25: 512
ITF: 16
OneD: 2047
PDF417: 33554432
QR_CODE: 67108864
UPC_A: 128
UPC_E: 256
BF_ALL = -32505857,
BF_ONED = 0x000007FF,
BF_GS1_DATABAR = 0x0003F800,
BF_POSTALCODE = 0x01F00000,
BF_CODE_39 = 0x1,
BF_CODE_128 = 0x2,
BF_CODE_93 = 0x4,
BF_CODABAR = 0x8,
BF_ITF = 0x10,
BF_EAN_13 = 0x20,
BF_EAN_8 = 0x40,
BF_UPC_A = 0x80,
BF_UPC_E = 0x100,
BF_INDUSTRIAL_25 = 0x200,
BF_CODE_39_EXTENDED = 0x400,
BF_GS1_DATABAR_OMNIDIRECTIONAL = 0x800,
BF_GS1_DATABAR_TRUNCATED = 0x1000,
BF_GS1_DATABAR_STACKED = 0x2000,
BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL = 0x4000,
BF_GS1_DATABAR_EXPANDED = 0x8000,
BF_GS1_DATABAR_EXPANDED_STACKED = 0x10000,
BF_GS1_DATABAR_LIMITED = 0x20000,
BF_PATCHCODE = 0x00040000,
BF_USPSINTELLIGENTMAIL = 0x00100000,
BF_POSTNET = 0x00200000,
BF_PLANET = 0x00400000,
BF_AUSTRALIANPOST = 0x00800000,
BF_UKROYALMAIL = 0x01000000,
BF_PDF417 = 0x02000000,
BF_QR_CODE = 0x04000000,
BF_DATAMATRIX = 0x08000000,
BF_AZTEC = 0x10000000,
BF_MAXICODE = 0x20000000,
BF_MICRO_QR = 0x40000000,
BF_MICRO_PDF417 = 0x00080000,
BF_GS1_COMPOSITE = -2147483648,
BF_NULL = 0x00
API 7.1.3 members 7.2.2 members
LocalizationResultAngle
ResultPoints
TerminateStage
angle
x1, x2, x3, x4
y1, y2, y3, y4
ResultPoints
accompanyingTextBytes
barcodeFormat
barcodeFormatString
barcodeFormatString_2
barcodeFormat_2
confidence
documentName
moduleSize
pageNumber
regionName
resultCoordinateType
terminatePhase
TextResult AccompanyingTextBytes
BarcodeBytes
BarcodeFormat
BarcodeFormatString
BarcodeText
LocalizationResult
DocumentName
ModuleSize
PageNumber
RegionName
BarcodeFormat
BarcodeFormatString
BarcodeText
LocalizationResult
bUnduplicated
barcodeBytes
barcodeFormat
barcodeFormatString
barcodeFormatString_2
barcodeFormat_2
barcodeText
detailedResult
localizationResult
results
RuntimeSettings barcodeFormatIds
binarizationModes
deblurLevel
expectedBarcodesCount
localizationModes
minBarcodeTextLength
minResultConfidence
region
resultCoordinateType
scaleDownThreshold
textResultOrderModes
timeout
barcodeFormatIds
binarizationModes
deblurLevel
expectedBarcodesCount
furtherModes
intermediateResultSavingMode
intermediateResultTypes
localizationModes
maxAlgorithmThreadCount
minBarcodeTextLength
minResultConfidence
pdfRasterDPI
region
resultCoordinateType
scaleDownThreshold
terminatePhase
textResultOrderModes
timeout
API7.1.3 members7.2.2 members
ScannerConfigUIElement
duplicateForgetTime
intervalTime
onFrameRead
onUnduplicatedRead
videoSettings
duplicateForgetTime
intervalTime
oneDRememberFrameCount
oneDTrustFrameCount
  • For better performance. A few synchronous methods have been changed to asynchronous ones.
API7.1.3 Return Value7.2.2 Return Value
destroyvoidPromise<any>
getRuntimeSettingsRuntimeSettingsPromise<RuntimeSettings>
resetRuntimeSettingsvoidPromise<void>
getScanSettingsScannerConfigPromise<ScannerConfig>

Making Use of New APIs

A few new APIs were added for advanced features introduced in the new version

  • Added a new API Dynamsoft.BarcodeReader._bUseFullFeature.
    This API is used to specify whether or not to use the full-feature package of the library. The default value is false, by setting it to true before you create an instance of the library, you can use the full-feature WASM. Check out more about the two WASMs.

    If you’d like to try it out first, you can compare our default demo page and full-feature demo page.
  • Added a new API Dynamsoft.BarcodeReader.engineResourcePath which can be used to set or retrieve the location of the WASM files.
  • Added a new API Dynamsoft.BarcodeReader.version which returns the version of the library.
  • Added APIs bSaveOriCanvas and oriCanvas.
    These APIs can be used to paint the actual frame that was decoded onto a Canvas which can be used for debugging.
  • Added many new Enumerations and one Interface.

    New Enumerations include EnumBarcodeColourMode, EnumBarcodeComplementMode, EnumBarcodeFormat_2, EnumBinarizationMode, EnumColourClusteringMode, EnumColourConversionMode, EnumConflictMode, EnumDeformationResistingMode, EnumDPMCodeReadingMode, EnumExtendedBarcodeFormat, EnumGrayscaleTransformationMode, EnumImagePreprocessingMode, EnumIMResultDataType, EnumIntermediateResultSavingMode, EnumIntermediateResultType, EnumQRCodeErrorCorrectionLevel, EnumRegionPredetectionMode, EnumResultCoordinateType, EnumResultType, EnumTextAssistedCorrectionMode, EnumTextFilterMode, EnumTextResultOrderMode, EnumTextureDetectionMode.

    The new Interface is FrameFilter.

    Check out more information here.

If you would like to learn more about how to use these new features or how they might help optimize your application, please feel free to contact Dynamsoft support.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe Newsletter

Subscribe to our mailing list to get the monthly update.

Subscribename@email.com