简体   繁体   中英

Can ZXing can read multiple barcode in the single image using C#?

I am trying to read multiple barcodes in a jpg image using the ZXing library. But it's returning only one barcode. I am not getting any source on how I can modify my code so that it read multiple barcodes. My code is:

private string readPDFBarcode(String fname) {
            
            IBarcodeReader reader = new BarcodeReader()
            {
                AutoRotate = true,
                TryInverted = true,
                Options = new DecodingOptions
                {
                    TryHarder = true,
                    PureBarcode = false,
                    ReturnCodabarStartEnd = true,
                    PossibleFormats = new List<BarcodeFormat> { BarcodeFormat.CODE_128, BarcodeFormat.CODE_39, BarcodeFormat.UPC_E }
                }
            };
            
            Bitmap oBitmap = new Bitmap(fname);
            var result = reader.Decode(oBitmap);
            if (result != null)
            {
                return result.ToString();
            }
            else {
                return "";
            }
        }

Any suggestions will be of great help. Thank you!

Try this one:

var results = reader.DecodeMultiple(oBitmap);

If it isn't available in your environment, please give some information about the target .net framework (classic or core).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM