Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Barcode Reader > C#.NET Barcode Recognition Guide > How to Decode Code 39 Linear Barcodes in C#.NET Application
Download Barcode Reader for .NET Trial

How to Decode Code 39 Barcodes in C#

Guide for Code 39 barcode recognition using C# for .NET programs
  • Use .NET barcode reading functions for Code 39 recognition in Visual C# class lib
  • Easily install C# Code 39 Barcode Reader DLL to ASP.NET and .NET WinForms applications
  • Read & scan Code 39 barcodes for C#.NET Class Library and Console applications
  • Read & output Code 39 linear barcodes data from jpeg, jpg, gif, png, tiff, and bmp image files
  • Able to decode Code 39 barcode together with the check digit using free one line C# code
  • Support other linear & 2d barcode decoding, like Code 39, Code 128, EAN-8, UPC-E, QR-Code,
    Data Matrix, PDF-417, etc
  • Royalty free to redistribute this C#.NET Barcode Scanner SDK with ordered license
How to Add C#.NET Code 39 Reading Control to VS
  1. Please add BarcodeLib.BarcodeReader.dll to your C#.NET project reference at the beginning.
How to Read Code 39 Barcodes in C# Class Library
BarcodeLib.com offers free C# demo code for Code 39 C# barcode decoding, so please directly use the one line code below.
     string[] results = BarcodeReader.read("c:/code39-csharp.gif", BarcodeReader.CODE39);
This C# demo code will read all the Code 39 barcodes in the image file "code39-csharp.gif".
How to Optimize Code 39 Barcode Reading Effect in C# Class
To optimize Code 39 recognition effect, we also provide other ways of Code 39 barcode scanning. This is suitable especially when the source image file is in a large size, like 4mb per image.

1. Decode the Maximum One Code 39 from Image Source

If you need to scan the maximum one Code 39 in a image source (per image, page in tiff or pdf document), please set maxOneBarcodePerPage to true.
  1. In this condition, our Code 39 C#.NET Barcode Scanning Component will stop reading the barcode as soon as it detects one Code 39 barcode.
  2. On the contrary, if this property is false (default value), our Code 39 C#.NET Barcode Scanning Component will use total 5 algorithms and each will read the whole source file from 4 directions.

2. Read the Partial Image of a Source File

If the Code 39 barcode is always located on specific area in image file, you can customize Code 39 C#.NET Barcode Reader Component to read that area only. And this is a good way to save a lot of reading time, CPU and memory usage.
  1. Please 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 free C# demo code explains how to read Code 39 from a specified area of an image source. Let's take top 20% and bottom 20% of the image as an example.
     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);

setting.setAreas(areas);

string[] results = BarcodeReader.read("c:/code39-csharp.gif", BarcodeReader.CODE39, setting);
Code 39 Barcode Reading Guide for Other .NET Projects
Scan 1D Barcode Images:
Scan 2D Barcode Images: