Home  >  .NET Barcode Generator Suite  >  .NET Barcode Generation Guide  >  .NET Barcode Generating Library for Data Matrix
.NET Barcode Data Matrix Generator for ASP.NET, C#, VB.NET
.NET Data Matrix Barcode Generating Component offers the most affordable .NET barcode generator for barcode .NET professionals to generate & create Data Matrix barcode images in .NET applications.
.NET Data Matrix Barcode Type Introduction
Data Matrix is also known as Data Matrix, ECC200. It is a two-dimensional (2D) barcode symbology which can store from 1 to about 2,000 characters.
DataMatrix ECC200 version supports advanced encoding error checking and correction algorithms (reed-solomon). Those algorithms allow the recognition of barcodes that are up to 60% damaged.
How to Generate Data Matrix Barcode in .NET Windows Forms Controller
  1. Add KeepDynamic.BarCode.Windows.dll to your WinForms project reference
  2. Add KeepDynamic.BarCode.Windows.dll to windows project toolbox
  3. Drag & drop the DataMatrixControl item to your windows forms
How to Generate Data Matrix Barcode in ASP.NET Web Control
  1. Add KeepDynamic.BarCode.AspNet.dll to your ASP.NET web class project reference
  2. Add KeepDynamic.BarCode.AspNet.dll to windows project toolbox
  3. Copy "datamatrix.aspx", "datamatrix.aspx.cs" from folder barcode to your ASP.NET project
  4. Drag & drop the DataMatrixControl item from toolbox to your ASP.NET Web form pages
How to Generate Data Matrix Barcode Images in .NET Projects Using C# Code
// Create Data Matrix barcode object in C#
DataMatrix barcode = new DataMatrix();

// Enter encodable value for Data Matrix barcode using C#
barcode.CodeText = "Data Matrix in C#";

// Set Data Matrix barcode size-related properties
barcode.X = 3;
barcode.TopMargin = 3;
barcode.BottomMargin = 3;
barcode.LeftMargin = 3;
barcode.RightMargin = 3;

//Customize unique barcode setting of Data Martrix
barcode.DataMode = DataMatrixDataMode.Auto;
barcode.FormatMode = DataMatrixFormatMode.FM_52X52;

// Set Data Matrix drawing image format to PNG in C#
barcode.Format = System.Drawing.Imaging.ImageFormat.Gif;

// Generate Data Matrix barcode & encode to the png image in C#
barcode.drawBarcode("C://barcode-datamatrix-csharp.gif");
More C# code for Data Matrix barcode generation in .NET project
How to Generate Data Matrix Barcode Images in .NET Projects Using VB.NET Code
' Create Data Matrix barcode object in VB.NET
Dim barcode As New DataMatrix()

' Enter encodable value for Data Matrix barcode using VB.NET
barcode.CodeText = "Data Matrix in VB.NET"

' Set Data Matrix barcode size-related properties
barcode.X = 3
barcode.TopMargin = 3
barcode.BottomMargin = 3
barcode.LeftMargin = 3
barcode.RightMargin = 3

'Customize unique barcode setting of Data Martrix
barcode.DataMode = DataMatrixDataMode.Auto
barcode.FormatMode = DataMatrixFormatMode.FM_52X52

' Set Data Matrix drawing image format to PNG in VB.NET
barcode.Format = System.Drawing.Imaging.ImageFormat.Gif

' Generate Data Matrix barcode & encode to the png image in VB.NET
barcode.drawBarcode("C://barcode-datamatrix-vbnet.gif")
More VB.NET code for Data Matrix barcode generation in .NET project
.NET Data Matrix Barcodes Properties

Barcode properties HTTP Parameters Default Comments
CodeText code-text "" The data that is used to encode into the barcode symbology. Data Matrix is a high-density barcode symbology that is capable of encoding text, numbers, files and actual data bytes. Encodable data character set of Data Matrix:

  • All 128 characters of ASCII
  • Characters of entended ASCII
GraphicsUnit graphics-unit GraphicsUnit.Pixel The unit of measurement for all size related settings.
  • 0: pixel
  • 1: cm
  • 2: inch
  • The default value is pixel.
X x 3 The narrow bar module width of Data Matrix and the default value of X is 3 pixels.

This value of X dimension may need to be increased to enhance the readability of the barcode if the barcode scanners could not read the barcode with small X dimension.
LeftMargin left-margin 0 The property to set the distance between the symbol and the left margin of a barcode image.
RightMargin right-margin 0 The property to set the distance between the symbol and the right margin of a barcode image.
TopMargin top-margin 0 The property to customize the space between the symbol and the top margin on a barcode image
BottomMargin bottom-margin 0 The property to change the space between the symbol and the bottom margin on a barcode image
Resolution resolution 72 This property set the resolution in DPI of a barcode image to be drawn, and the default value that is set to printer is 72 pixels. You can adjust the value to get a custom resolution barcode image.
Rotate rotate 0 The Rotate property allows you changing the angle of a barcode. The valid values are:
  • Rotate0: do not rotate the barcode
  • Rotate90: rotate the barcode 90 degrees clockwise
  • Rotate180: rotate the barcode 180 degrees clockwise
  • Rotate270: rotate the barcode 270 degrees clockwise
Format format ImageFormat.Png This is a method that is used for exporting barcode to different type of image formats. It allows developers generate barcode in formats like JPEG/JPG, BMP, GIF, and PNG.

The default method is ImageFormat.Png. Image format type. Using System.Drawing.Imaging.ImageFormat
ProcessTilde process-tilde false Set the processTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is false.

~NNN: is used to represent the ASCII character with the value of NNN. NNN is from 000 - 255.
DataMode data-mode DataMatrixDataMode.ASCII The data can be encoded into Data Matrix with the below data encoding modes.
  • Auto (0): this barcode engine will automatically match the best data mode for you.
  • ASCII (1): it is used to encode data that mainly contains ASCII characters (0-127). This is the default encoding format by Barcode Library.
  • C40 (2): it is used to encode data that mainly contains numeric and upper case characters.
  • Text (3): it is used to encode data that mainly contains numeric and lower case characters.
  • X12 (4):it is used to encode the standard ANSI X12 electronic data interchange characters.
  • EDIFACT (5): it is used to encode 63 ASCII values (values from 32 to 94) plus an Unlatch character (binary 011111).
  • Base256 (6): it is used to encode 8 bit values.
FormatMode format-mode DataMatrixFormatMode.FM_10X10 Default is DataMatrixFormatMode.FM_10X10. Specifies the Data Matrix Format to use on that symbology.
FNC1 fnc1 0 (none) FNC1 is the single character Function Code 1, which alternates the data type identifier to identify the data type or is used as as a field separator
ApplicationIndicator application-indicator 0 Also known as: Application Identifier. It is used to identify the data type in a symbol and is primarily used in GS1 symbologies.
StructuredAppend structure-append false If true, then Structured Append is enabled. It allows files of data to be represented in up to 16 Data Matrix symbols. The original data can be correctly reconstructed regardless of the order in which the symbols are scanned.
SymbolCount symbol-count 1 Set the number of total symbols which make the sequence.
SymbolIndex symbol-index 1 Set the position of current symbol in the secuence (Start with 0).
FileId file-id 0 Set the property to be identified to the same file. It increases the probability that only logically linked symbols are processed as part of the same message

How to Create 1D & 2D Barcode Images Using .NET Data Matrix Barcoding Library