Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created May 27, 2021 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/cb6ddb3cf026a54b122d94f127c8dfbf to your computer and use it in GitHub Desktop.
Save aspose-com-gists/cb6ddb3cf026a54b122d94f127c8dfbf to your computer and use it in GitHub Desktop.
Read Barcodes in Node.js
// specify barcode image's path
let file_name = "code11.png";
// create a barcode reader
let reader = new BarCodeReader(file_name, null, null);
// read barcodes
reader.readBarCodes().forEach(function (result, i, results)
{
console.log(result.getCodeText());
console.log("\n");
console.log(result.getCodeTypeName());
});
// specify barcode image's path
let file_name = "code128.jpg";
// create a barcode reader
let reader = new BarCodeReader(ea.loadImageByName(this.subfolder, file_name), null, DecodeType.CODE_128);
// read barcodes
reader.readBarCodes().forEach(function (result, i, results)
{
console.log("Code Text : " + result.getCodeTypeName());
console.log("\n");
console.log("Code Type : " + result.getCodeText());
});
// specify barcode image's path
let file_name = "code11.png";
// create a barcode reader
let reader = new BarCodeReader(file_name, null, null);
// set quality settings
reader.setQualitySettings(QualitySettings.getHighPerformance());
reader.getQualitySettings().setAllowMedianSmoothing(true);
reader.getQualitySettings().setMedianSmoothingWindowSize(5);
// read barcodes
reader.readBarCodes().forEach(function (result, i, results)
{
console.log(result.getCodeText());
console.log("\n");
console.log(result.getCodeTypeName());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment