npm install barcode4nodejs

Node.js bindings to Dynamsoft Barcode Reader C/C++ SDK.

More from yushulx

yushulx npm packages

Find the best node modules for your project.

Search npm

barcode4nodejs

Node.js bindings to Dynamsoft Barcode Reader C/C++ SDK...

Read more

Documentation

A README file for the barcode4nodejs code repository. View Code

Node.js Barcode & QR Code SDK

The Node.js barcode QR code SDK is implemented by wrapping Dynamsoft Barcode Reader C++ SDK. It helps developers to build Node.js barcode and QR code scanning applications for Windows, Linux, macOS, Raspberry Pi and Jetson Nano.

Dynamsoft Barcode Reader SDK Version

v9.6.40

License Key for SDK

Pre-requisites

Supported Platforms

Supported Barcode Symbologies

API

Template Usage

  1. Visit the barcode reader online demo.
  2. Customize parameters in advanced settings and then download the template.

For example:

let params = {
  "ImageParameter": {
    "Name": "Custom_143301_827",
    "BarcodeFormatIds": [
      "BF_ALL"
    ],
    "DeblurLevel": 9,
    "ExpectedBarcodesCount": 100,
    "ScaleDownThreshold": 1200000,
    "Timeout": 100000
  },
  "Version": "3.0"
};
template = JSON.stringify(params);

Quick Usage

Replace LICENSE-KEY with your own license key.

const dbr = require('barcode4nodejs');
dbr.initLicense("LICENSE-KEY")
dbr.decodeFileAsync("YOUR IMAGE FILE", dbr.formats.OneD | dbr.formats.PDF417 | dbr.formats.QRCode | dbr.formats.DataMatrix | dbr.formats.Aztec, function(err, msg){
  console.log(msg);
  for (index in msg) {
    result = msg[index];
    console.log('Format: ' + result['format']);
    console.log('Value : ' + result['value']);
    console.log('x1: ' + result['x1']);
    console.log('y1 : ' + result['y1']);
    console.log('x2: ' + result['x2']);
    console.log('y2 : ' + result['y2']);
    console.log('x3: ' + result['x3']);
    console.log('y3: ' + result['y3']);
    console.log('x4: ' + result['x4']);
    console.log('y4: ' + result['y4']);
    console.log('page: ' + result['page']);
    console.log('decoding time: ' + result['time']);
  }
}, "");

// Or
(async function () {
  try {
    var result = await dbr.decodeFileAsync("YOUR IMAGE FILE", dbr.formats.OneD | dbr.formats.PDF417 | dbr.formats.QRCode | dbr.formats.DataMatrix | dbr.formats.Aztec, "");
    console.log(result);
  } catch (error) {
    console.log(error);
  }
})();

How to Customize and Build the Module

  1. Get the source code:

    git clone https://github.com/yushulx/nodejs-barcode.git
    
  2. Download Dynamsoft C++ Barcode SDK. Copy header files to src folder and copy platform-specific shared libraries to platforms folder.

  3. Edit src/dbr.cc and index.js.

  4. Build the Node.js extension:

    node-gyp configure
    node-gyp build
    

    For Visual Studio 2019 Community

    node-gyp configure --msbuild_path="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" --msvs_version=2017
    node-gyp build
    

Examples