C# Leitcode Reader Library
C# Imaging - Scan Leitcode Barcode in C#.NET
C# Code to Scan Leitcode on Image and Document.
Leitcode Scanning in C#.NET Overview
RasterEdge Barcode Add-on controls are the most comprehensive barcode toolkits on the market, which support both reading and writing of about 30 barcode types and sub-types, including all the commonly used linear and 2D barcodes. As for our barcode reader, RasterEdge offers the fastest barcode recognition APIs. RasterEdge Barcode Reader is optimized to provide very high accuracy even on poor quality images and document files with damaged barcodes. In addition, users can integrate RasterEdge Barcode Reader functionalities into your .NET applications easily, such as Visual C#.NET, Visual Basic .NET, ASP.NET Web and Windows Forms for VS.NET.
Related .net document control helps:
c# asp.net mvc document viewer: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
c# asp.net text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net document viewer open source:
EdgeDoc:ASP.NET Document Viewer C# Control:
Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
asp.net edit pdf image using c#:
ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net edit pdf text using c#:
ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
c# asp.net dicom viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
This article mainly talks about the C#.NET Leitcode Barcode Reader in RasterEdge .NET Imaging SDK, which is designed to help users to decode Leitcode barcode from images and document pages.
C#.NET Leitcode Scanning Features
Integrating Leitcode reading functionality into C#.NET application is very easy
Maximize the benefits of Leitcode high speed processors via multiple threads and cores
Support Leitcode reading on both bitonal and color barcode images
Clean noisy or damaged images to improve recognition accuracy in C#.NET
Read Leitcode barcode from poor quality PDF, Word, Excel & PowerPoint document files with high accuracy
Reduce the human interaction requirement with the high accuracy recognition
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.
Scan Leitcode from Images in C#.NET
As you would hope, it's easy to scan Leitcode from images in C#.NET application. Please note that, following C# demo code is for recognizing Leitcode from PNG images. Other supported raster image formats are: JPEG, GIF & BMP.
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.Leitcode);
// 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 Leitcode Barcode Scanning from Document(TIFF, PDF, Office)
In order to run the following demo codes reading Leticode 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;
Recognize Leitcode from TIFF Image in C#.NET
Following C# sample code allows users to read Leitcode from TIFF image with RasterEdge .NET Barcode Reader.
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.Leitcode);
// 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);
}
|
Scan Leitcode from PDF in C#.NET
Compared with reading Leitcode from images, scanning Leitcode from PDF will be a little more challenging for that users should convert the PDF barcode pages into images first before you can read Leitcode barcode. Following sample C# code will display the detailed steps.
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.Leitcode);
// 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);
}
|
Scan Leitcode from Word in C#.NET
Scanning Leitcode barcode from Word document is nearly like that from PDF: converting Word document into images and then reading Leitcode from images. Use below C# demo code for an easier Leitcode scanning from Word.
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.Leitcode);
// 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);
}
|
Recognize Leitcode Barcode from Excel in C#.NET
The Leitcode barcode reading from Excel sheet is similar to Leitcode barcode scanning from above mentioned PDF or Word file.
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.Leitcode);
// 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);
}
|
Decode Leitcode Barcode from PowerPoint in C#.NET
Following sample code is used to read all Leitcode barcodes from 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.Leitcode);
// 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);
}
|