This project has moved and is read-only. For the latest updates, please go here.

Reading multiple barcodes VB.net

Jan 7, 2016 at 2:50 PM
Please help me with reading multiple barcodes from an image. I have the following code which works fine for 1 barcode but I need te read multiple (about 10 per image):

'Code start
Imports ZXing
Imports ZXing.Common
Imports ZXing.Rendering

    Private Sub PrintBarcodes(image As Bitmap)
        Dim reader As IBarcodeReader = New BarcodeReader()
        Try
            Dim barcodeBitmap = DirectCast(image, Bitmap)
            Dim result = reader.Decode(barcodeBitmap)
            If result IsNot Nothing Then
              'some code
            End If
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub
'end code

I think it is something simple but I cant find any documentation.

Please help.

Many thanks in advance.
Jan 8, 2016 at 10:15 AM
Imports ZXing.Multi

    Private Sub PrintBarcodes(image As Bitmap)
        Dim reader As IMultipleBarcodeReader = New BarcodeReader()
        Try
            Dim results = reader.DecodeMultiple(image)
            If results IsNot Nothing Then
                For Each result As Object In results
                    'code
                Next
            End If
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub
Jan 18, 2016 at 7:40 AM
Hi Roossien,

I have found a way of dealing with reading multiple qr codes from an image which might be helpful to you reading multiple barcodes from an image. You need to cover scanned barcodes with filled rectangles in an image, save the image and rescan the other barcodes. You will need to loop to do this.
May 10, 2016 at 3:05 PM
This is a great idea. Let it read one, then cover it up, and read the next one. However, the result points seem to be completely wrong... Did you run into this?
May 14, 2016 at 1:57 AM
You have to let ZXing barcode reader scan only for the type of barcodes you want to scan for. I ran into this problem with QR codes before as I didn't make ZXing barcode reader to only scan for QR codes.