Miss any of our Open RFC calls?Watch the recordings here! »

barcode-js

13.2.1 • 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:
    • Linux 64 bit or Windows 64 bit.
    • node -v 8.0 or greater and npm.
  2. Install the package (and its dependencies) by running the command npm install barcode-js.

Note that although barcode-js will install on Node.js 8, support for it is deprecated and will be removed in a future version. We recommend using the latest Active LTS or Maintenance LTS release of Node.js.

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.2/BxNodeJs/webframe.html.

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

  • java -version JRE 1.8 or later.

Licensing notes

On CentOS 8 operating system Barcode Xpress License Manager may not work since some cryptographic protocols are disabled by default. In this case to install a license on the local computer required mode can be enabled with the following command (run it as a root):

update-crypto-policies --set LEGACY

After installing the license default mode can be enabled with the command:

update-crypto-policies --set DEFAULT

See command description: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening

More Documentation and Support

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

Install

npm i barcode-js

DownloadsWeekly Downloads

6

Version

13.2.1

License

SEE LICENSE IN licensing/AccusoftLicenseAgreement.txt

Unpacked Size

23 MB

Total Files

35

Last publish

Collaborators

  • avatar