micjahn/ZXing.Net

UPC/EAN Extension 2/5 does not read the 2/5 digit extension

Opened this issue · 0 comments

I'm attempting to scan comic book/magazine bar codes. They look like this:
barcode3
My code looks like this:
string barcode = string.Empty;
using (var stream = file.OpenReadStream())
{

    try
    {
        stream.Seek(0, SeekOrigin.Begin);
        using var coreCompatImage = (Bitmap)Bitmap.FromStream(stream);
        var coreCompatReader = new ZXing.Windows.Compatibility.BarcodeReader();
        coreCompatReader.Options.PossibleFormats = new List<BarcodeFormat> { BarcodeFormat.UPC_A, 
BarcodeFormat.UPC_EAN_EXTENSION, BarcodeFormat.ITF };
         var coreCompatResult = coreCompatReader.Decode(coreCompatImage);
        var test = coreCompatReader.DecodeMultiple(coreCompatImage);
        barcode = coreCompatResult?.Text ?? string.Empty;
     }    
    catch (Exception exc)
    {
        return "Error processing the image: ";
    }
}
return barcode;

Test is an array with 1 item, even if UPC_EAN_EXTENSION is the only possible format provided. The one item is the 12 digits from the UPC_A format. I have used this image with a barcode scanner that is aware of the 5 digit extension, and get the correct code back, which leads me to suspect it's a problem with my implementation or the library.

I appreciate the help