Created
May 27, 2021 10:48
-
-
Save aspose-com-gists/cb6ddb3cf026a54b122d94f127c8dfbf to your computer and use it in GitHub Desktop.
Read Barcodes in Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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