ByteScout Barcode Reader SDK - VB.NET - Parallel Barcode Decoding - ByteScout

ByteScout Barcode Reader SDK – VB.NET – Parallel Barcode Decoding

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – VB.NET – Parallel Barcode Decoding

parallel barcode decoding in VB.NET with ByteScout BarCode Reader SDK

How to use ByteScout BarCode Reader SDK for parallel barcode decoding in VB.NET

Every ByteScout tool contains example VB.NET source codes that you can find here or in the folder with installed ByteScout product. Parallel barcode decoding in VB.NET can be implemented with ByteScout BarCode Reader SDK. ByteScout BarCode Reader SDK is the SDK for barcode decoding. Can read all popular types from Code 128, GS1, UPC and Code 39 to QR Code, Datamatrix, PDF417. Images, pdf, TIF images and live web camera are supported as input. Designed to handle documents with noise and defects. Includes optional splitter and merger for pdf and tiff based on barcodes. Batch mode is optimized for high performance with multiple threads. Decoded values can be exported to XML, JSON, CSV or into custom data format.

The SDK samples like this one below explain how to quickly make your application do parallel barcode decoding in VB.NET with the help of ByteScout BarCode Reader SDK. This VB.NET sample code should be copied and pasted into your application’s code editor. Then just compile and run it to see how it works. VB.NET application implementation typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.

Trial version can be downloaded from our website. Source code samples for VB.NET and documentation are included.

Try ByteScout BarCode Reader SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

Module1.vb
      
Imports Bytescout.BarCodeReader Imports System.Threading Module Module1 Const InputFile As String = ".\example.pdf" ' Limit to 4 threads in queue. ' Set this value to number of your processor cores for max performance. Dim ThreadLimiter As Semaphore = New Semaphore(4, 4) <MTAThread()> Sub Main() Const numberOfRuns As Integer = 10 Dim doneEvents(numberOfRuns - 1) As ManualResetEvent For i As Integer = 0 To numberOfRuns - 1 ' Wait for the queue ThreadLimiter.WaitOne() doneEvents(i) = New ManualResetEvent(False) ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf ThreadProc), New Object() {i, doneEvents(i)}) Next WaitHandle.WaitAll(doneEvents) Console.WriteLine("All threads done.") Console.WriteLine() Console.WriteLine("Press any key to exit...") Console.ReadKey() End Sub Sub ThreadProc(ByVal stateInfo As Object) Dim threadIndex As Integer = stateInfo(0) Dim waitEvent As ManualResetEvent = stateInfo(1) Console.WriteLine("Thread #" & threadIndex & " started...") Try Dim reader As New Reader() reader.RegistrationName = "demo" reader.RegistrationKey = "demo" ' Set barcode type to find reader.BarcodeTypesToFind.Code128 = True ' ----------------------------------------------------------------------- ' NOTE: We can read barcodes from specific page to increase performance . ' For sample please refer to "Decoding barcodes from PDF by pages" program. ' ----------------------------------------------------------------------- ' Read barcodes Dim barcodes As FoundBarcode() = reader.ReadFrom(InputFile) ' Cleanup reader.Dispose() Console.WriteLine("Thread #" & threadIndex & " finished with " & barcodes.Length & " barcodes found.") Catch ex As Exception Console.WriteLine("Thread #" & threadIndex & " failed with exception:\r\n" & ex.Message) Finally ' Signal the thread is finished waitEvent.Set() ' Release semaphore ThreadLimiter.Release() End Try End Sub End Module

Try ByteScout BarCode Reader SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

VIDEO

ON-PREMISE VERSION INFORMATION

Get 60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Get ByteScout BarCode Reader SDK Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Tutorials:

prev
next