C# Patch Code Reader Library
C# Imaging - Scan Patch Code in C#.NET
C# Patch Code Reader SDK Library by Using RasterEdge Barcode Reader SDK
C#.NET Patch Code Reader SDK Overview
RasterEdge .NET Imaging SDK includes the most professional and easiest 1D and 2D barcode reader which is able to keep your implementation costs low, and add barcode support to your .NET application in just a few lines of code. What's more, within RasterEdge Barcode Reader, users can simply decode and recognize all the supported barcodes from multiple image and document file formats.
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 mvc excel viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
c# asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
With RasterEdge fully-managed barcode reading code for C#.NET application development, users are capable of reading and decoding Patch Code on images (including: PNG, TIFF, JPEG, BMP and GIF) and documents (PDF and Word).
Besides, for Patch Code reading in other .NET applications, please see how to read Patch in VB.NET, ASP.NET barcodes decoding and .NET WinFroms barcodes scanning.
C#.NET Patch Code Decoding Features
Integrated with .NET Imaging SDK with the ability to save the decoded barcode to file
Scan and recognize Patch Code from any directions in C# class and console application
Available stand-alone that integrated with .NET imaging features
Read Patch Code from PDF document file and C#.NET image objects
C# code to scan Patch Code from Word document pages
Return decoded Patch Code data string in 100% accuracy
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.
Read Patch Code on Images in C#.NET Project
Featuring a fast, highly accurate and reliable barcode reading and writing engine for C#.NET application, RasterEdge .NET Barcode Reader Add-on allows users to scan Patch Code from PNG, TIFF, JPEG, BMP & JPEG images. And below is C# demo code of reading Patch Code on png file.
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.PatchCode);
// 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 Patch Code Barcode Scanning from Document(TIFF, PDF, Office)
In order to run the following demo codes reading Patch Code 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 Patch Code from TIFF Image in C#.NET Project
Following C# sample code allows users to read Patch Code 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.PatchCode);
// 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);
}
|
Read Patch Code on PDF in C#.NET Project
RasterEdge Barcode Reader Add-on also supports reading Patch Code from PDF document images directly. For PDF document barcode reading, users need to convert PDF document to images at first.
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.PatchCode);
// 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);
}
|
Read Patch Code on Word in C#.NET Project
Comprehensive and reliable Word document Patch Code reader is one of the fundamental RasterEdge barcode reading capabilities. Users who want to decode Patch Code from Word document need to apply RasterEdge.Imaging.MSWordDocx.dll and RasterEdge.Imaging.MSWordDocx.dll to convert the Word document into images and then read the Patch Code from images. The detailed C# demo codes are listed below.
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.PatchCode);
// 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);
}
|
Detect Patch Code Barcode from Excel Sheet
If you want to scan Patch Code barcode(s) from whole Excel sheet or certain Excel area, this C# Patch Code barcode reader control can be a good choice.
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.PatchCode);
// 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);
}
|
Scan Patch Code Barcode Image from PowerPoint
This C# demo code allows developers to decode all Patch Code 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.PatchCode);
// 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);
}
|