QR Code Image Sample - pqScan.com
.NET Barcode Reader SDK Building up Perfect Quality Barcode Reading Software for .NET Online Demo Download Trial Purchase Now

C# & VB.NET Data Matrix Scanning

back to home  >  .NET Barcode Reader SDK  >  Recognize Barcodes in .NET  >  Data Matrix Recognition in C# & VB.NET

This page is a detailed online tutorial for how to use pqScan .NET Barcode Scanner SDK to read and recognize Data Matrix barcode from various images in VB.NET and C# programming environments. If you have downloaded this product package (free trial), then please carefully read through the following parts to have an overall understanding of Data Matrix barcode font recognition for VB.NET and C#.NET programming applications.

At the very beginning, you are supposed to have an overview of pqScan .NET Barcode Recognition SDK (free trial) package. This package mainly contains a PQScan.BarcodeScanner.dll assembly that will be used in Visual C# and Visual Basic .NET Data Matrix recognition projects. Also, pqScan End User License Agreement and a free demo are included in .NET barcode reader software package.

Please note that, for evaluation, C# and VB.NET users do not need to activate this software. And the only limitation for testing is that our .NET barcode scanner software will randomly read the first character encoded in each of your target Data Matrix barcode.

Let's Start 2D Data Matrix Scanning

Our .NET Barcode Reader DLL empowers VB.NET and C#.NET programmers to use well designed barcode decoding APIs to read Data Matrix 2d barcodes from common raster image files, including bmp, gif, jpeg, jpg, png, tif, and tiff, These image files can be loaded in the form of bitmap, local picture or stream. Please note, it's required enough graphs resolution to make the barcode image clear.

Visual C# Data Matrix Scanning

The following APIs can help you to achieve high quality 2d bar code decoding easily. In general, you can use the first three APIs for your Data Matrix reading in C# programs. There may be a group of barcodes in the picture, and can be located in any position of the pictrue, our .net barcode scanner will resolve it easily, can read all the barcode symbol out. If you want to save barcode reading time, you may use the second three APIs to define the barcode type as Data Matrix. Then, our barcode scanner dll component for .NET will only read Data Matrix bar codes from loaded image source. Moreover, to improve barcode recognition accuracy, we provide ScanSingle APIs for one barcode recognition. It is suitable when there's only one barcode on your image.

public static BarcodeResult[] Scan(Bitmap bitmap);
public static BarcodeResult[] Scan(Stream stream);
public static BarcodeResult[] Scan(string filename);

public static BarcodeResult[] Scan(Bitmap bitmap, BarCodeType barType);
public static BarcodeResult[] Scan(Stream stream, BarCodeType barType);
public static BarcodeResult[] Scan(string filename, BarCodeType barType);

public static BarcodeResult ScanSingle(Bitmap bitmap);
public static BarcodeResult ScanSingle(Stream stream);
public static BarcodeResult ScanSingle(string filename);

In the following code boxes, you will see Visual C# demo codes for defining Data Matrix as target barcode type and read all of them from your load image source (sample: a string value) and reading one Data Matrix from image using ScanSingle method (more accurate).

public void ScanDataMatrixFromFile(string filename)
  // Scan and recognize Data Matrix only from loaded image file.
  BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.DataMatrix);

  foreach (BarcodeResult result in results)
    Console.WriteLine(result.BarType.ToString() + "-" + result.Data);
Bitmap bmp = new Bitmap("YourImagePath");
BarcodeResult barcode = BarCodeScanner.ScanSingle(bmp);
Console.WriteLine("barcode data:{0}.", barcode.Data);

Visual Basic Data Matrix Scanning

Here, we also provide robust APIs and Visual Basic demo codes for all barcode types reading from image file including Data Matrix two-dimensional barcode, and single Data Matrix barcode reading from image. For more details of VB.NET barcode reading, please see Barcode Recognition Using VB.NET - Overview

public static BarcodeResult[] Scan(Bitmap bitmap)
public static BarcodeResult[] Scan(Stream stream)
public static BarcodeResult[] Scan(string filename)

public static BarcodeResult[] Scan(Bitmap bitmap, BarCodeType barType)
public static BarcodeResult[] Scan(Stream stream, BarCodeType barType)
public static BarcodeResult[] Scan(string filename, BarCodeType barType)

public static BarcodeResult ScanSingle(Bitmap bitmap)
public static BarcodeResult ScanSingle(Stream stream)
public static BarcodeResult ScanSingle(string filename)
Public Sub ScanAllFromFile(ByVal filename As String)
  ' Scan and recognize all barcode types from loaded image file.
  Dim results() As BarcodeResult = BarCodeScanner.Scan(filename)

  Dim result As BarcodeResult
  For Each result In results
    Console.WriteLine(result.BarType.ToString() + "-" + result.Data)
End Sub
' Used to improve barcode reader accuracy when there's only one Data Matrix on your image.
Dim bmp As Bitmap = New Bitmap("YourImagePath") 
Dim barcode As BarcodeResult = BarCodeScanner.ScanSingle(bmp) 
Console.WriteLine("barcode data:{0}.", barcode.Data)
pqScan SDK
.NET Barcode Reader Software
Online Guide
Barcode Scanning for .NET Barcode Scanning Using C# Barcode Scanning Using VB
Barcode Type
C#/VB Guide: Read QR Code C#/VB Guide: Read PDF-417 C#/VB Guide: Read Aztec Code C#/VB Guide: Read Code 128 C#/VB Guide: Read Code 39 C#/VB Guide: Read EAN-13 C#/VB Guide: Read EAN-8 C#/VB Guide: Read UPC-A C#/VB Guide: Read UPC-E C#/VB Guide: Read Code 93 C#/VB Guide: Read Codabar C#/VB Guide: Read ITF-14 View All Barcodes >>
I'm struggled to find a barcode reading solution that truly do it all. Then, find pqScan .NET Barcode Scanner SDK. All problems are solved at a reasonable price. I highly recommend it! Christopher Heath