Recognize and generate Data Matrix barcodes using VintaSoft Barcode .NET SDK.

Blog category: Barcode.NET

August 19, 2025

VintaSoft Barcode .NET SDK is a professional cross-platform SDK for Windows, Linux, macOS, Android, which allows to recognize and generate Data Matrix barcodes in .NET, WPF, Web, MAUI. VintaSoft Barcode .NET SDK allows to embed the functionality of recognition and generation of Data Matrix barcodes using just a few lines of code.


What is Data Matrix barcode?

Data Matrix is a two-dimensional matrix barcode that has become widespread in industry, production and product labeling. A distinctive feature of the Data Matrix barcode is the search pattern "L" in the form of a solid line on both sides of the barcode:



Features of Data Matrix barcode

The modern Data Matrix barcode version ECC200 is defined by the ISO/IEC 16022 standard from 2006. The standard also describes legacy versions from ECC000 to ECC140, which are not recommended for use.

The Data Matrix barcode can store mixed data of different types in three encoding modes:

The Data Matrix barcode uses the Reed-Solomon error correction algorithm, which allows to recognize damaged barcodes.

Support for the GS1 standard allows you to encode data in GS1 format (BarcodeSymbologySubsets.GS1DataMatrix).

The Data Matrix barcode can encode the following special symbols:


Rectangular Data Matrix barcode - when the marking area is not square

There are 6 special versions of the rectangular Data Matrix barcode:


These barcodes are used on small items when the available area does not allow for a square barcode.


Data Matrix Barcode Structure

The Data Matrix barcode matrix version ECC200 has 24 square versions ranging in size from 10x10 to 144x144 modules, as well as rectangular versions: 8x18, 8x32, 12x26, 12x36, 16x36 and 16x48 modules. The orientation of the barcode is determined by the search pattern "L" the center of which is located in the lower left corner of the barcode.



It is easy to distinguish the modern version of Data Matrix ECC200 from the outdated version ECC000-ECC140: in the ECC200 version the matrix size is always even, and in ECC000-140 it is always odd, therefore in the ECC200 version there is always a white module in the upper right corner, and in the outdated version there is always a black module.


If you need to encode a large amount of data - a special symbol Structure Append

The Data Matrix barcode supports a special symbol "Structure Append", which allows you to split the data into several Data Matrix barcodes. The "Structure Append" symbol is encoded in the barcode and allows you to definitely determine the number of barcode parts and their order:

VintaSoft Barcode .NET SDK contains an algorithm for recovering data from a set of barcodes-parts of the Data Matrix that were separated using the "Structure Append" symbol.


What Data Matrix barcodes can VintaSoft Barcode .NET SDK recognize?

VintaSoft Barcode .NET SDK recognizes all types of Data Matrix barcodes version ECC200. During recognition, unique algorithms are used that allow you to quickly recognize barcodes that have various problems:



Here is a C# code that demonstrates how to recognize Data Matrix barcodes in an image captured from a camera:
/// <summary>
/// Reads Data Matrix barcodes from a <see cref="System.Drawing.Bitmap"/>.
/// </summary>
/// <param name="bitmap">A bitmap with barcodes.</param>
public static void ReadDataMatrixBarcodesFromBitmap(System.Drawing.Bitmap bitmap)
{
    // create barcode reader
    using (Vintasoft.Barcode.BarcodeReader reader = new Vintasoft.Barcode.BarcodeReader())
    {
        // specify that reader must search for Data Matrix barcodes
        reader.Settings.ScanBarcodeTypes = Vintasoft.Barcode.BarcodeType.DataMatrix;

        // read barcodes from image
        Vintasoft.Barcode.IBarcodeInfo[] infos = Vintasoft.Barcode.GdiExtensions.ReadBarcodes(reader, bitmap);

        // if barcodes are not detected
        if (infos.Length == 0)
        {
            System.Console.WriteLine("No barcodes found.");
        }
        // if barcodes are detected
        else
        {
            // get information about extracted barcodes

            System.Console.WriteLine(string.Format("{0} barcodes found:", infos.Length));
            System.Console.WriteLine();
            for (int i = 0; i < infos.Length; i++)
            {
                Vintasoft.Barcode.IBarcodeInfo info = infos[i];
                System.Console.WriteLine(string.Format("[{0}:{1}]", i + 1, info.BarcodeType));
                System.Console.WriteLine(string.Format("Value:      {0}", info.Value));
                System.Console.WriteLine(string.Format("Region:     {0}", info.Region));
                System.Console.WriteLine();
            }
        }
    }
}


What Data Matrix barcodes can VintaSoft Barcode .NET SDK generate?

VintaSoft Barcode .NET SDK generates all types of Data Matrix barcodes.

Here is the C# code that demonstrates how to generate a Data Matrix barcode bitmap:
/// <summary>
/// Returns the Data Matrix barcode as <see cref="System.Drawing.Bitmap"/>.
/// </summary>
/// <param name="value">The barcode value.</param>
/// <returns>A <see cref="System.Drawing.Bitmap"/> object.</returns>
public static System.Drawing.Bitmap GetDataMatrixBarcodeAsBitmap(string value)
{
    // create the barcode writer
    using (Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter())
    {
        // set barcode writer settings
        barcodeWriter.Settings.Barcode = Vintasoft.Barcode.BarcodeType.DataMatrix;
        barcodeWriter.Settings.Value = value;

        // get a barcode image as System.Drawing.Bitmap
        return Vintasoft.Barcode.GdiExtensions.GetBarcodeAsBitmap(barcodeWriter);
    }
}


Here is some C# code that demonstrates how to generate a vector (SVG) image of Data Matrix barcode:
/// <summary>
/// Returns the Data Matrix barcode in vector form as a SVG string.
/// </summary>
/// <param name="barcodeValue">Barcode value.</param>
public static void GetDataMatrixBarcodeAsSvgString(string barcodeValue)
{
    // create the barcode writer
    using (Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter())
    {
        // set barcode writer settings
        barcodeWriter.Settings.Barcode = Vintasoft.Barcode.BarcodeType.DataMatrix;
        barcodeWriter.Settings.Value = barcodeValue;

        // generate Data Matrix barcode as a SVG string
        return barcodeWriter.GetBarcodeAsSvgFile();
    }
}