C# Code 39 Reader Library
C# Imaging - Read Linear Code 39 in C#.NET
C#.NET Imaging Class to Read Linear Code 39 on Image & Documents.
Code 39 Decoding in C#.NET Overview
Code 39, also named as ANSI/AIM Code 39, ANSI/AIM Code 39, Uniform Symbology Specification Code 39, USS Code 39, is a discrete, variable-length linear barcode symbology widely used in non-retail environments. It is self-checking in that a single print defect cannot transpose one character into another valid character.
Related .net document control helps:
asp.net sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net dicom document viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net pdf document viewer: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
asp.net annotate pdf:
ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net edit pdf image:
ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net pdf viewer: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
RasterEdge .NET Imaging SDK provides the fast, accurate and reliable linear and 2D barcodes decoder and reader for users in any Visual .NET applications and environments, inlcluding C#.NET, ASP.NET, VB.NET and .NET WinForms. What makes RasterEdge Barcode Reader famous and unique is that it can read and decode nearly 30 supported barcodes from images and documents files in high-speed and high-quality.
This tutorial article mainly demonstrates how to decode Code 39 linear barcode symbol in C#.NET image application. RasterEdge Code 39 Barcode Reader SDK is one of the premier barcode reading toolkit of RasterEdge .NET Imaging SDK, which supports scanning and recognizing Code 39 barcode from JPEG, JBIG2, TIFF, BMP, PNG & GIF images and PDF, Word, Excel & PowerPoint documents by using C# sample codes. We also provide Code 39 creation in C#.NET and VB.NET Code 39 barcode reading. For more 1D barcodes reading in ASP.NET and 1D barcodes reading in .NET WinForm guide, please check the tutorial articles.
Code 39 Decoding Features in C#.NET
Easy to integrate Code 39 reader into C#.NET application
C# code to scan Code 39 on multiple image formats, like BMP, GIF, JPEG, JBIG, PNG, TIFF formats
Support reading Code 39 from single and multi-page documents
C# code to recognize Code 39 related size detail quickly
Decode Code 39 barcode foreground and background colors in C#.NET Project
Read Code 39 barcode font correctly and fast with C# class
C# code for simple barcode reading such as separator pages in batch scanning jobs
Runtime royalty free options are available for desktop or server deployments
Steps to Read/Scan Data Matrix from Image/PDF/TIFF/Office File
Load an image or a document(PDF, TIFF, Word, Excel, PowerPoint).
Get a Bitmap or BasePage used to decode or read barcode.
Set the barcode reader settings.
Call the following static method in BarcodeReader.cs to read or scan barcode from Bitmap or BasePage.
public static Barcode[] ReadBarcodes(ReaderSettings settings, BasePage page)
public static Barcode[] ReadBarcodes(ReaderSettings settings, Bitmap image)
The barcode information will be saved in the array of Barcode object. While, if you read barcodes information from the BasePage failed, you can try as follows:
Convert BasePage to Bitmap with higher resolution by Calling method ConvertToImage(int resolution) in the BasePage.cs:
//Convert page to bitmap.
//The default resolution is 96, if youo set the resolution higher, it will be better to read or scan barcode.
Bitmap bmp = page.ConvertToImage(192);
// read all barcodes in the page
Barcode[] barcodes = BarcodeReader.ReadBarcodes(settings, bmp);
foreach (Barcode barcode in barcodes)
{
Console.WriteLine("Data: " + barcode.DataString);
}
|
If you want to have a try, please refer to the following demo codes.
Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:
If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.
If using x86, the platform target should be x86.
C#.NET: Read Code 39 Barcode on Image
RasterEdge .NET Code 39 Barcode Reader SDK makes it easy to scan Code 39 barcode from raster images in C#.NET, like PNG, JPEG, BMP, TIFF & GIF.
Add necessary references to your C#.NET project. Right-click the project and select "Add Reference..." to locate and add the following DLLs as project references;
RasterEdge.Imaging.Basic.dll
RasterEdge.XImage.BarcodeScanner.dll
Use corresponding namespaces;
using RasterEdge.XImage.BarcodeScanner;
Bitmap bmp = new Bitmap(inputDirectory + "Sample_Barcode.png");
// config reader setting
ReaderSettings settings = new ReaderSettings();
// define the type of barcode to scan
settings.AddTypesToRead(BarcodeType.Code39);
// read all barcodes in the document
Barcode[] barcodes = BarcodeReader.ReadBarcodes(settings, bmp);
foreach (Barcode barcode in barcodes)
{
Console.WriteLine("Data: " + barcode.DataString);
}
|
C#: DLLs for Code 39 Barcode Scanning from Document(TIFF, PDF, Office)
In order to run the following demo codes reading Code 39 from document, the steps as follows are necessary.
Add references:
RasterEdge.Imaging.Basic.dll
RasterEdge.Imaging.Basic.Codec.dll
RasterEdge.Imaging.Processing.dll
RasterEdge.Imaging.Font.dll
RasterEdge.Imaging.Drawing.dll
RasterEdge.XImage.BarcodeScanner.dll
RasterEdge.XImage.Raster.Core.dll
RasterEdge.XImage.Raster.dll
Use corresponding namespaces;
using RasterEdge.XImage.BarcodeScanner;
using RasterEdge.Imaging.Basic;
C#.NET: Read Code 39 from TIFF Image File
RasterEdge .NET Code 39 Barcode Reader SDK also supports Code 39 decoding from TIFF image formats.
Add references(Extra):
RasterEdge.XDoc.TIFF.dll
Use corresponding namespaces(Extra):
using RasterEdge.XDoc.TIFF;
// load TIFF document
TIFFDocument doc = new TIFFDocument(inputDirectory + "Sample_Barcode.tif");
// get the page you want to scan
BasePage page = doc.GetPage(0);
// set reader setting
ReaderSettings setting = new ReaderSettings();
// set type to read
setting.AddTypesToRead(BarcodeType.Code39);
// read barcode from tiff page
Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);
foreach (Barcode barcode in barcodes)
{
// print the loaction of barcode on image
Console.WriteLine(barcode.BoundingRectangle.X + " " + barcode.BoundingRectangle.Y);
// output barcode data onto screen
Console.WriteLine(barcode.DataString);
}
|
C#.NET: Read Code 39 Barcode on PDF
With RasterEdge Barcode Add-on, users are not supposed to decode Code 39 linear barcode from PDF document files directly. To do so, users need to use the RasterEdge.Imaging.PDF.dll to convert PDF document to GIF, TIFF, BMP, JPEG, JBIG2 or PNG image at the beginning, and then use RasterEdge.Imaging.Barcode.Scanner.dll to recognize Code 39 from the converted images easily. Following demo C# codes can help you with a more logic programming.
Add references(Extra):
RasterEdge.XDoc.PDF.dll
Use corresponding namespaces(Extra):
using RasterEdge.XDoc.PDF;
// load PDF document
PDFDocument doc = new PDFDocument(inputDirectory + "Sample_Barcode.pdf");
// get the page you want to scan
BasePage page = doc.GetPage(0);
// set reader setting
ReaderSettings setting = new ReaderSettings();
// set type to read
setting.AddTypesToRead(BarcodeType.Code39);
// read barcode from PDF page
Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);
foreach (Barcode barcode in barcodes)
{
// print the loaction of barcode on image
Console.WriteLine(barcode.BoundingRectangle.X + " " + barcode.BoundingRectangle.Y);
// output barcode data onto screen
Console.WriteLine(barcode.DataString);
}
|
C#.NET: Scan Code 39 Barcode on Word
Code 39 Barcode Reader allows users to decode Code 39 barcode from Word document with accuracy and dependability. As you can see from following C# sample, users should transfer Word document pages to images before the barcode decoding like with PDF document.
Add references(Extra):
RasterEdge.XDoc.Word.dll
RasterEdge.XDoc.Office.Inner.Common.dll
RasterEdge.XDoc.Office.Inner.Office03.dll
Use corresponding namespaces(Extra):
using RasterEdge.XDoc.Word;
// load Word document
DOCXDocument doc = new DOCXDocument(inputDirectory + "Sample_Barcode.docx");
// get the page you want to scan
BasePage page = doc.GetPage(0);
// set reader setting
ReaderSettings setting = new ReaderSettings();
// set type to read
setting.AddTypesToRead(BarcodeType.Code39);
// read barcode from Word page
Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);
foreach (Barcode barcode in barcodes)
{
// print the loaction of barcode on image
Console.WriteLine(barcode.BoundingRectangle.X + " " + barcode.BoundingRectangle.Y);
// output barcode data onto screen
Console.WriteLine(barcode.DataString);
}
|
C#.NET: Recognize Code 39 Barcode from Excel
All Code 39 images can be accurately decoded from specific Excel sheet using following sample C# code.
Add references(Extra):
RasterEdge.XDoc.Excel.dll
RasterEdge.XDoc.Office.Inner.Common.dll
RasterEdge.XDoc.Office.Inner.Office03.dll
Use corresponding namespaces(Extra):
using RasterEdge.XDoc.Excel;
// load Excel document
XLSXDocument doc = new XLSXDocument(inputDirectory + "Sample_Barcode.xlsx");
// get the page you want to scan
BasePage page = doc.GetPage(0);
// set reader setting
ReaderSettings setting = new ReaderSettings();
// set type to read
setting.AddTypesToRead(BarcodeType.Code39);
// read barcode from Excel page
Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);
foreach (Barcode barcode in barcodes)
{
// print the loaction of barcode on image
Console.WriteLine(barcode.BoundingRectangle.X + " " + barcode.BoundingRectangle.Y);
// output barcode data onto screen
Console.WriteLine(barcode.DataString);
}
|
C#.NET: Decode Code 39 Barcode from PowerPoint
Sample C# code to decode all Code 39 barcodes included in the source PowerPoint slide.
Add references(Extra):
RasterEdge.XDoc.PowerPoint.dll
RasterEdge.XDoc.Office.Inner.Common.dll
RasterEdge.XDoc.Office.Inner.Office03.dll
Use corresponding namespaces(Extra):
using RasterEdge.XDoc.PowerPoint;
// load PowerPoint document
PPTXDocument doc = new PPTXDocument(inputDirectory + "Sample_Barcode.pptx");
// get the page you want to scan
BasePage page = doc.GetPage(0);
// set reader setting
ReaderSettings setting = new ReaderSettings();
// set type to read
setting.AddTypesToRead(BarcodeType.Code39);
// read barcode from PowerPoint page
Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);
foreach (Barcode barcode in barcodes)
{
// print the loaction of barcode on image
Console.WriteLine(barcode.BoundingRectangle.X + " " + barcode.BoundingRectangle.Y);
// output barcode data onto screen
Console.WriteLine(barcode.DataString);
}
|
Common Asked Questions
What is Code 39 barcode used for?
Code 39 (also called Code 3 of 9) was the first barcode to encode both numbers and letters. Code 39 is widely used for labeling and tracking assets in industries like logistics, government, defense, and manufacturing, as it can encode both letters and numbers.
Using RasterEdge C# Code 39 Barcode Reader SDK library, you can scan and decode Code 39 barcodes from
multi-page PDF, TIFF documents and raster image files in ASP.NET, MVC, Blazor, Windows Forms and WPF applications.
What does Code 39 mean on a barcode reader?
Code 39 is a linear barcode type. It is a simple one-dimensional barcode that can contain up to 43 characters, such as capital letters, digits, and special symbols. Code 39 Extension supports encoding all 128 ASCII characters.
Using XImage.Barcode Reader C# library, you can scan and decode verified and correct Code 39 codes from
images in Visual Studio .NET projects.
How does a barcode reader decode Code 39?
When decoding Code 39 text from a barcode image, a barcode scanner checks all the bar and space elements of the Code 39 barcode, and uses a character lookup table to convert the bar and space combinations into Code 39 data characters. The reader software analyzes the alternating bars and spaces, comparing the patterns to a known set to output the encoded characters.
Using C# Code 39 Scanner SDK API, you do not need understand the Code 39 decoding algorithms, the barcode reader library will
scan, decode and return verified Code 39 data codes from image files in C# class.
What's the difference between Code 39 and Code 128 barcodes?
A key difference is error checking. Code 128 needs a checksum, Code 128 includes a mandatory checksum digit that helps the scanner verify and correct a damaged barcode, even if damaged, it may still be scanned Code 39's checksum is optional; a damaged Code 39 barcode without a checksum is unreadable by scanners.
RasterEdge C# Barcode Reader library supports both Code 39 and Code 128 and other linear barcodes scanning and decoding
in ASP.NET Core, Console, WinForms, WPF applications.