C# Code 39 Reader Introduction
C# Code 39 Reader SDK is a high performance C# linear and 2d barcode recognition SDK for Microsoft Visual Studio C#.NET platform.
Scan and read Code 39 barcodes from image files is one of the barcode decoding functions in .NET Barcode Reader component. To help .net developers easiy integrate barcode reader control into your .net projects, we provide detailed online tutorial for
C#.NET Barcode Reader component supports scanning and reading 20+ linear, 2d barcodes, including
- Read QR Code in C# | Read Code 128 in C# | Read Code 93 in C# | Read Data Matrix in C#
- Read PDF-417 in C# | Read EAN-13 in C# | Read EAN-8 in C# | Read UPC-A in C#
You may also be interested in:
- Java Barcode Reader for Java | Barcode Generator for Java | Barcode Generator for .NET | Barcode Generator for C#
- Barcode Generator for ASP.NET | Barcode Generator for VB.NET
Install C#.NET Barcode Reader Control to Your C# project
- Copy OnBarcode.Barcode.BarcodeScanner.dll to your C#.NET project folder (do not copy dll file to your project bin folder).
- Add OnBarcode.BarcodeReader.dll to your C# project reference.
Reading Code 39 in C# Class
- Call
BarcodeScanner.Scan()method to get all scanned Code 39 text string in your C# class.
Pass your Code 39 barcode image file path or image inStream,byte arrayobject, and Code 39 barcode type (BarcodeType.Code 39) as method parameters. - Call
BarcodeScanner.ScanInDetails()method to get detected Code 39 barcodes with detailed information.
The scanned Code 39 barcode information includes Code 39 barcode location, rotation, data in ASCII label, in bytes, and Code 39 check character if any.
string[] datas = BarcodeScanner.Scan("code39-barcode-sample.png", BarcodeType.Code39); BarcodeDetail[] datasInDetail = BarcodeScanner.ScanInDetails( "code39-barcode-sample.png", BarcodeType.Code39);
Scan Code 39 extension (full ASCII) mode
If the scanned Code 39 is an extended Code 39 (full ASCII mode), you need choose barcode type as
Code 39 extension barcode may include ASCII control characters, which are not printable. You can use method
BarcodeType.Code39Extension.
Code 39 extension barcode may include ASCII control characters, which are not printable. You can use method
GetASCIITextMessage() to read Code 39
text string with control characters replaced with visible labels.
BarcodeDetail[] datasInDetail = BarcodeScanner.ScanInDetails( "barcode-code39-extension-sample.png", BarcodeType.Code39Extension); foreach (BarcodeDetail barcodeData in datasInDetail) { Debug.WriteLine("Data: " + barcodeData.Data); Debug.WriteLine("ASCII: " + barcodeData.GetASCIITextMessage()); }
Scan Code 39 barcode with check character in C#
The Code 39 and Code 39 extension ISO standard does not define the criteria for determining whether a Code 39 barcode includes a checksum.
If your scanning Code 39 or Code 39 extension barcode include checksum, you need apply the following setting in
ScanOption object.
- Enable property
Code39WithCheckCharacterto true. The barcode reader library will verify the scanned Code 39 data with the last digit checksum, and return Code 39 data without checksum included. - Call method
GetMessage()to get the Code 39 data without checksum character. - Call method
GetBarcodeProps()to retrieve the Code 39 barcode information, where you can get the Code 39 checksum character in propertyChecksum
ScanOptions ops = new ScanOptions(BarcodeType.Code39); // true: to verify checksum and extract Code39Props from the candidator. ops.Code39WithCheckCharacter = true; BarcodeDetail[] result = BarcodeScanner.Scan(imgFilePath, ops); if (result != null && result.Length > 0) { foreach (BarcodeDetail b in result) { Console.WriteLine("Message: {0}", b.GetMessage()); Code39Props props = (Code39Props)b.GetBarcodeProps(); if (props != null && props.HasChecksum) Console.WriteLine("Checksum: {0} ('{1}')", props.Checksum, props.ShowChar); else Console.WriteLine("No Checksum"); } } else Console.WriteLine("No Barcode Found");
C# Barcode Reading & Scanning Tutorials
Barcode Reader SDK for C#.NET - Barcode Image Reading
- Read Linear / 1D Barcode Images:
- Read Matrix / 2D Barcode Images: Data Matrix, PDF-417, QR Code
| Australia Post | Codabar | Code 39 | Code 93 | Code 128 |
| EAN 8 | EAN 13 | GS1 128 (UCC/EAN128) | Identcode | Intelligent Mail |
| Interleaved 2 of 5 | ISBN | ISSN | ITF-14 | Leitcode |
| Patch Code | Planet | Postnet | RM4SCC | UPC-A |
| UPC-E |
Common Asked Questions
What is Code 39 barcode used for?
Code 39, also known as Code 3 of 9, was the first barcode to encode both numbers and letters. It is most commonly used in
the inventory, government, military and electronics industries.
Using C# barcode reader library, you can easily scan and recognize Code 39 text from barcode images in C# ASP.NET Core, MVC, WinForms, WPF apps.
What is the Code 39 on a barcode reader?
Code 39 is a 1d barcode symbology that encodes up to 43 characters, including uppercase letters, numbers, and special symbols.
Code 39 extension supports encoding full 128 ASCII characters.
Using C# Barcode Scanner library, you can scan and decode all 128 ASCII characters from Code 39 and Code 39 extension barcode images in C# class.
How to decode Code 39?
To scan and decode Code 39 text from a barcode image, a barcode scanner device or reader software will scan all bar and space modules on the Code 39 barcode symbology,
and use a character map to translate the bar and space groups into Code 39 data characters.
OnBarcode C# Barcode Scanner library will help C# developer quickly integrate Code 39 barcode scanning and reading features in a C# ASP.NET, MVC, web and Windows application.
What is the difference between Code 39 and Code 128 barcodes?
Code 128 requires a checksum. If the Code 128 barcode is damaged, it may still be scannable. Code 39 checksum is optional.
If the Code 39 barcode without checksum is damaged, it won't be scannable.
In C# class, you can scan, recognize and decode both Code 128 and Code 39 barcode data from image files using C# Barcode Reader library.