The C# Code 39 Reader SDK is a high performance linear and 2D barcode recognition SDK for Microsoft Visual Studio .NET platforms. Scanning and reading Code 39 barcodes from image files is one of the barcode decoding functions provided by the .NET Barcode Reader component. To assist .NET developers in integrating the barcode reader control into their projects, detailed online tutorials are available.
C# Code 39 Barcode Reader Library
QR Code, Data Matrix, Code 128, GS1, EAN/UPC. Multi-thread reading in C# ASP.NET, Windows application.
The above C# code will get all Code39 barcodes in image file "code39-barcode.gif".
Scan & Read Code 39 Barcodes in VB.NET
Scan and read Code39 barcode in VB.NET is an easy and simple task. One line of vb.net code finishes the job.
Dim datas() AsString = BarcodeReader.read("c:/code39-barcode.gif", BarcodeReader.CODE39)
The above VB.NET code will get all Code39 barcodes in image file "code39-barcode.gif".
Optimize Code 39 Barcode Reading Performance in C#.NET & VB.NET
You can customize our .NET barcode reader component, to improve Code 39 barcode reading speed, when you are scanning large image size (like 4mb per image).
Set maxOneBarcodePerPage to true, if there is maximum one barcode per image or per page in tiff or pdf document. If maxOneBarcodePerPage is true, the .net barcode reader library will stop scanning the barcode immediately, once detects one barcode. If maxOneBarcodePerPage is false (default value), the library will use total 5 algorithms and each will scan the whole image from 4 directions.
Scan the partial image instead of the whole file. If the barcode is always located one specified area in the image, you can set and let the library scan that area only. And it will reduce lots of scanning time, CPU and memory usage. You just specify the left top point and right bottom point of the area (the point X, Y values are expressed in percentage of the whole image, so image most left top point is (0%, 0%), and most right bottom point is (100%, 100%)).
The following C# code explains how to scan top 20% of the image and bottom 20% of the image.
OptimizeSetting setting = new OptimizeSetting();
setting.setMaxOneBarcodePerPage(true);
ScanArea top20 = new ScanArea(new PointF(0.0F, 0.0F), new PointF(100.0F, 20.0F));
ScanArea bottom20 = new ScanArea(new PointF(0.0F, 80.0F), new PointF(100.0F, 100.0F));
List<ScanArea> areas = new List<ScanArea>(); areas.Add(top20); areas.Add(bottom20);
The following VB.NET code explains how to scan top 20% of the image and bottom 20% of the image.
Dim setting As OptimizeSetting = New OptimizeSetting()
setting.setMaxOneBarcodePerPage(True)
Dim top20 As ScanArea = New ScanArea(New Drawing.PointF(0.0F, 0.0F), New Drawing.PointF(100.0F, 20.0F))
Dim bottom20 As ScanArea = New ScanArea(New Drawing.PointF(0.0F, 80.0F), New Drawing.PointF(100.0F, 100.0F))
Dim areas As List(Of ScanArea) = New List(Of ScanArea) areas.Add(top20) areas.Add(bottom20)
setting.setAreas(areas)
Dim datas() AsString = BarcodeReader.read("c:/code39-barcode.gif", BarcodeReader.CODE39, setting)
Scanning Code 39 with Checksum
The Code 39 ISO standard does not define whether a Code 39 barcode includes a checksum. If the scanned Code 39 barcode includes a checksum, the following settings must be applied:
Set Code39WithCheckCharacter to true in the ScanOptions object. The library verifies the scanned data against the last digit checksum and returns the data without the checksum.
Use GetMessage() to retrieve the Code 39 data without the checksum.
Use GetBarcodeProps() to retrieve the Code 39 barcode information, where the checksum character can be accessed via the Checksum property.
Summary
This tutorial has provided a comprehensive guide to integrating Code 39 barcode reading capabilities into .NET applications using C# and VB.NET. Developers can leverage the BarcodeLib Barcode Reader SDK to scan and decode Code 39 symbols from image files, extract barcode details, and handle checksum verification when present. The component seamlessly integrates into ASP.NET web applications, WinForms desktop applications, and WPF based solutions, enabling robust Code 39 barcode reading functionality across multiple .NET environments.