Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Barcode Scanner > C# Barcode Reading Tutorial > How to use C# Barcode Reader Library to read & decode Data Matrix barcode image
Download Barcode Reader for .NET Trial

How to Scan Data Matrix Barcode Using C#

How to scan & recognise Data Matrix barcode using C# Barcode Scanner DLL
  • All barcode reading & scanning features are written into an advanced C#.NET Barcode Reader Library
  • Fully compiled in Visual C# 2005, supporting high C# Data Matrix barcode reading & decoding speed
  • Free to download C# Data Matrix Barcode Reader Library for .NET barcode recognition projects
  • Read & scan 2d barcode Data Matrix for ASP.NET web & .NET Windows applications
  • Read & recognize Data Matrix barcode image for .NET, C#, VB.NET class library applications
  • Besides Data Matrix barcode, QR Code & PDF-417 2d barcodes are supported by C# barcode reading library
  • Also support C# linear barcode scanning, mainly including Code 39, Code 128, EAN, UPC and so on
How to Add Data Matrix C# Barcode Reader DLL to VS .NET Project
  1. Please firstly download free .NET Barcode Reader Library DLL trial package.
  2. Then, add BarcodeLib.BarcodeReader.dll to your C#.NET project reference.
How to Use C# Class Library to Scan Data Matrix 2D Barcode Image
After adding .NET Barcode Reader DLL to your application reference, please directly copy the following free sample code to your C# class library.
     string[] results = BarcodeReader.read("c:/datamatrix-csharp.gif", BarcodeReader.DATAMATRIX);
With the above C# sample code, all the barcode images in file "datamatrix-csharp.gif" will be scanned and decoded.
How to Use Advanced Features to Read C# Data Matrix Barcode Image
BarcodeLib.com .NET Barcode Reader DLL can be used to read Data Matrix barcode images for .NET, ASP.NET Web, Windows, C#, VB.NET Class Library applications. To fulfill all programmers requests, we also provide the following barcode scanning methods for special requirements of these .NET programs.

1. Scan the Maximum One (Data Matrix) Barcode from a Large Size Image Source

To achieve this, you need to customize the property maxOneBarcodePerPage to true.
  1. In this case, our C#.NET Data Matrix Barcode Reader DLL will stop reading the barcode when it detects one Data Matrix barcode.
  2. If not "true", our C#.NET Data Matrix Barcode Scanner DLL will use total 5 algorithms and each will scan the whole source file from 4 directions.

2. Scan a Specific Part of the Source Image File Where the Data Matrix Barcode Is Located

If your Data Matrix barcode image is always located on specific area on the image file, you may set C#.NET Data Matrix Reader Library to scan that area only. And this helps to save a lot of reading time, CPU and memory usage.
  1. As for the specific are, you can just specify the left top point and right bottom point of the area (the point X, Y values are expressed in percentage of the whole image, so image most left top point is (0%, 0%), and most right bottom point is (100%, 100%)).
Below is an example of specific area Data Matrix scanning, and we take top 20% and bottom 20% of a sample image file "datamatrix-csharp.gif" as an example.
     OptimizeSetting setting = new OptimizeSetting();

setting.setMaxOneBarcodePerPage(true);

ScanArea top20 = new ScanArea(new PointF(0.0F, 0.0F), new PointF(100.0F, 20.0F));

ScanArea bottom20 = new ScanArea(new PointF(0.0F, 80.0F), new PointF(100.0F, 100.0F));

List<ScanArea> areas = new List<ScanArea>();
areas.Add(top20);
areas.Add(bottom20);

setting.setAreas(areas);

string[] results = BarcodeReader.read("c:/datamatrix-csharp.gif", BarcodeReader.DATAMATRIX, setting);
How to Use C# Class Library to Scan Other Linear & 2D Barcode Images
Scan 1D Barcode Images:
Scan 2D Barcode Images:
How to Read Linear & 2D Barcodes in Other .NET Projects