C# Imaging - Decode Identcode in C#.NET
Identcode Barcode Reader for C#.NET Document Imaging Application.
Support Read barcode from PDF in C#.
C#.NET Identcode Barcode Reading & Scanning Overview
Working with the core component from RasterEdge DocImage SDK for .NET, this C#.NET barcode reader & decoder library, control, toolkit can easily detect and scan Identcode from document files, several image files and .NET image objects. Written in managed C# code, this Identcode barcode reading control owns high compatibility with .NET-compliant developing applications, like windows forms application and ASP.NET web services.
Related .net document control helps:
asp.net edit pdf image:
ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net image viewer zoom: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net edit pdf text color:
ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net ppt viewer: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net mvc text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net tiff viewer control: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
Apart from Identcode linear (1d) postal barcode type, this C#.NET barcode scanning & decoding library can be also used to detect other postal barcode symbologies, including Intelligent Mail, Leitcode, Planet and Postnet.
What should be noted here is that the trial version of this barcode reader library control will decode the first character of scanned Identcode barcode casually. Thus, it is ok if you find the inconformity between the first character of decoded and encoded data when using the trial version to scan Identcode barcode from document image using C# code.
Besides, RasterEdge DocImage SDK for .NET can also generate barcode that conforms to established barcode standards and barcode specifications. Thus, if you are interested in Identcode barcode generation in VB.NET imaging application, please follow the link.
C#.NET Identcode Barcode Reading Control Features
Specifically used for .NET class application, like Windows and Web Forms
Easy-to-use, decode all Identcode barcodes from source file using few lines of C# code
Own advanced Identcode barcode reading functionality for C# PDF,Word, Excel & PPT editing projects
Add fully-featured Identcode scanning functions to C#.NET image processing applications
Define Identcode barcode scanning area in target document & image file using C# code
Restrict decoded Identcode barcode number to enhance barcode scanning rate using C#
Automatically detect scanned Identcode barcode orientation in C#.NET class application
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# Code for Identcode Barcode Reading from Image
This C#.NET barcode reader & scanner library control can accurately, quickly and reliably read & decode Identcode barcode from raster image file formats, like png, jpeg, gif, tiff and bmp. This C#.NET barcode reader also allows users to define certain area for Identcode barcode detecting and scanning.
For instance, if the Identcode barcode you are going to decode is located at one corner of a large-size image file, then you can reduce much time by directing the scanner to scan Identcode barcode just in a smaller area instead of a whole file. With the application of X & Y location, you can easily locate the scanning area in the image using C# code.
In the demo C# code below, we will take png files as examples to illustrate how to decode & scan Identcode barcode from raster image file using C#.NET.
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.Identcode);
// 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 Identcode Barcode Scanning from Document(TIFF, PDF, Office)
In order to run the following demo codes reading Identcode 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# Code for Decoding Identcode from TIFF Image File
Following C# sample code allows users to read Identcode 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.Identcode);
// 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# Code for Identcode Barcode Scanning from PDF
Along with the PDF processing library that provided from RasterEdge DocImage SDK for .NET, this barcode reading & decoding library control toolkit can also scan & recognize Identcode barcode from PDF document in C#.NET applications.
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.Identcode);
// 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);
}
|
How to Recognize Identcode Barcode from Word in C#
Similarly, coupled with Word document manipulating library included in RasterEdge DocImage SDK for .NET, this C#.NET barcode reader & decoder control component can be also used to recognize Identcode barcode from Word page.
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.Identcode);
// 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# Sample Code on Decoding Linear Identcode from Excel
With RasterEdge .NET Imaging Barcode Reading component and MS Excel dll, users are able to detect and decode Identcode on Excel document in high speed with the methods of locating the specific area of target barcode.
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.Identcode);
// 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);
}
|
How to Read Identcode from PowerPoint Document in C#
Following demo code in C# is for scanning Identcode barcode in a certain location of the first PowerPoint document page. If the barcode is in other page, users just need to change the "GetPage" number.
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.Identcode);
// 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);
}
|