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.
In this case, our C#.NET Data Matrix Barcode Reader DLL will stop reading the barcode when it detects one Data Matrix barcode.
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.
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);