Browse our Products

Aspose.BarCode for Node.js via Java 26.4

All Changes

KeySummaryCategory
BARCODENET-37745Reading barcodes from PDF - barcode is not recognizedBug
BARCODENET-38384Recognition of EAN barcodes while barcode read type is set to UPCBug
BARCODENET-38386Reader detects fragments of Code39Extended instead of VINBug
BARCODENET-38387Add option to BarCodeReader to recognize only required barcode typesEnhancement

Public API changes and New Features

OnlyRequestedTypes property for strict barcode type filtering

Methods setOnlyRequestedTypes(boolean) and isOnlyRequestedTypes() have been added to the Recognition.BarcodeSettings class.

When enabled, Recognition.BarCodeReader returns only the barcode types explicitly specified in the decoding settings. Compatible or equivalent barcode types are excluded from the results, even if they can be successfully recognized.

When disabled, compatible and equivalent barcode types may be returned according to internal type mapping. For example, EAN-13 may also be returned when UPC-A is specified as the decoding type.

let file_name = "test.png";
let filePath = ReleaseNotes.folder + file_name;

// --- generate barcode ---
let generator = new BarcodeGenerator(EncodeTypes.EAN_13,"2383823482894");

generator.save(filePath, BarCodeImageFormat.PNG);

// recognize only UPCA barcodes (no results, because source is EAN13)
let reader1 = new BarCodeReader(filePath, null, DecodeType.UPCA
);

reader1.getBarcodeSettings().setOnlyRequestedTypes(true);

let results1 = reader1.readBarCodes();

if (results1.length === 0) {
    console.log("No barcodes found (OnlyRequestedTypes = true)");
}

for (let i = 0; i < results1.length; i++) {
    console.log("BarCode CodeText: " + results1[i].getCodeText());
}

// recognize compatible types: EAN13, UPCA, ISSN, ISMN, ISBN (EAN13 will be returned as UPCA-equivalent)
let reader2 = new BarCodeReader(filePath,null,DecodeType.UPCA);

reader2.getBarcodeSettings().setOnlyRequestedTypes(false);

let results2 = reader2.readBarCodes();

if (results2.length === 0) {
    console.log("No barcodes found (OnlyRequestedTypes = false)");
}

for (let i = 0; i < results2.length; i++) {
    console.log("BarCode CodeText: " + results2[i].getCodeText());
}