barcode-js

13.9.3174 • Public • Published

BarcodeXpress

What is Barcode Xpress

Barcode Xpress for Node.js enables developers to add the ability to read common industry 1D and 2D barcodes in their applications.

  • Barcode Types - recognize over 30 different types of barcodes.
  • Structured Results - results are organized in a hierarchical model where every barcode has a value, type, confidence, and location.
  • Simple - by providing only a minimal asynchronous API, Barcode Xpress is easy to learn. With a few lines of code, recognize barcodes found in images produced by scanners, cameras, or fax machines.

Getting Started

  1. Make sure you have the following system requirements:
    • Windows x64 operating systems of the following versions:
      • Windows 8.1
      • Windows 10
      • Windows Server 2012 (and R2)
      • Windows Server 2016
      • Windows Server 2019
    • Linux x64 operating systems of the following versions:
      • Ubuntu 18.04
      • Ubuntu 20.04
      • CentOS 7
      • CentOS 8
      • Debian 9
      • Debian 10
    • Node.js versions 12, 14, 16 and npm (to check the version use the following command: node -v)
  2. Clone and run the Hello Barcode Xpress for Node.js Sample

Although Barcode Xpress for Node.js may run, it is not supported on earlier operating system versions (for example, Ubuntu 14.04 or Windows 7).

Reading Barcodes

// Import packages.
const bx = require("barcode-js");

// Set up logging function.
const logResults = (results) => console.log(JSON.stringify(results, ["type", "value", "confidence"], 2));

// Set up analysis function.
const analyzeBarcodes = async (filePath) => {
    try {
        const results = await bx.analyze(filePath);
        logResults(results);
    }
    catch(err) {
        console.error(`Fatal: Error analyzing image input\n${err}`);
    }
};

// Set up parameters.
// Accepted file types are bmp, tiff, jpg, gif, png, and url
const filePath = "test.bmp";

// Call analyze.
analyzeBarcodes(filePath);

Accessing Results

The analyze method returns an array of result objects.

Each result object has the following structure:

{
    "type": barcodeType,
    "value": barcodeValue,
    "area": {
        "x": xCoordinateBarcodeStart,
        "y": yCoordinateBarcodeStart,
        "height": barcodeHeight,
        "width": barcodeWidth
    },
    "corners": [
    {
        "x": xCoordinateTopLeft,
        "y": yCoordinateTopLeft
    },
    {
        "x": xCoordinateTopRight,
        "y": yCoordinateTopRight
    },
        {
        "x": xCoordinateBottomRight,
        "y": yCoordinateBottomRight
    },
        {
        "x": xCoordinateBottomLeft,
        "y": yCoordinateBottomLeft
    }
    ],
    "confidence": recognitionConfidence
}

For example, to get the confidence of a recognized barcode:

const barcodeValue = result.confidence;

or to get the height property of a recognized barcode:

const barcodeHeight = result.area.height;

Licensing

Barcode Xpress for Node.js comes with an evaluation license pre-installed, so you can get started right away.

For development and deployment licenses, and more information on licensing in general, please visit our online documention at https://help.accusoft.com/BarcodeXpress/v13.9/BxNodeJs/webframe.html.

In order to run the license manager, you will need:

  • java -version JRE 1.8 or later.

More Documentation and Support

Barcode Xpress also includes detailed API documentation and a Getting Started guide.

Package Sidebar

Install

npm i barcode-js

Weekly Downloads

52

Version

13.9.3174

License

SEE LICENSE IN LICENSE

Unpacked Size

15.4 MB

Total Files

36

Last publish

Collaborators

  • accusoft_npm