Chapter 2. Overview

This chapter briefly reviews the symbology (a.k.a. barcode formats) supported by DataMatrix Fonts & Encoder 5 - Data Matrix.

2.1. What is Data Matrix?

Data matrix is a variable-size, two-dimensional symbology capable of encoding large amount of data. The barcode consists of an array of data cells within a distinct perimeter pattern. Although it is capable of encoding 2000 characters, data matrix is best for encoding small amount of data when space is a primary concern. Data matrix is a space efficient symbology. When encoding small amount of data, it produces more compact barcodes than any other two dimensional symbologies.

Figure 2.1. Example Data Matrix Symbol

Example Data Matrix Symbol

The encoding process (converting data into an array of light/dark modules) is fairly complicated. First, to produce space efficient symbols, data matrix standard defines six character sets, also called encodation modes with each targeting a different kind of data. Data matrix encoder shifts the encodation mode from one to another whenever it sees that doing so will reduce the whole symbol size. Moreover, to make sure that the symbol can be read when some portions become damaged, the encoder adds additional modules for error correction purposes. The error correction algorithm by itself is not easy.

There are two types of data matrix bar codes: ECC 000-140 and ECC 200. The difference lies in the error correction algorithms they employ - the ECC 000-140 uses several levels of convolutional error correction and ECC 200 uses Reed-Solomon error correction. By employing Reed-Solomon error correction algorithm, ECC200 allows data to be successfully read, even if 60% of the data area is damaged. The most recent data matrix standard requires all new applications to use ECC 200.

Data matrix offers limited combinations between the number of rows and columns. A valid selection is called a data matrix size. All data matrix sizes are listed in the table below. A data matrix symbol can be any one of the 30 shapes.

Table 2.1. Data Matrix Sizes

Size IDSymbol SizeData Capacity

The size ID parameter used by our software is an interger. If value 0-29 are passed, it indicates the encoder should create a barcode that matches the size. However, it may increase the size if the encoder finds that the size requested is too small.

In version 5.0, two additional values are supported: -1 and -2. If -1 is specified, the program selects the minimum size that meets the requirement, and searching from the rectangular shape (0~23). If -2 is specified, the program searches from the square shape (24) first. And if no square shape sizes can encode the data, it then searches all rectangular shapes.

In version 5.1 and above, the descrition above still applies. However, size ID parameter is further enhanced to allow user to specify encodation mode selection and whether the encoder should increase the size if the size is determined too small. For details, refer to Appendix C, Size ID Parameter (updated in version 5.1).

2.2. Working with DataMatrix Font & Encoder 5

The methods to create barcodes are greatly expanded in this version. You should select one based on your working environment - Font, image or ActiveX control.

2.2.1. Font-Based

Font-based approach creates a datamatrix barcode by formatting the encoder output with data matrix font.


In almost all circumstances, you can not just type your number and format with a barcode font to create a valid barcode. You must generate the barcode string first, and format the barcode string with the font.

The Font-based approach is easy to understand, and in some occasions the only way to add barcode printing functionality, such as in Crystal Reports.

The drawing below illustrates how you create a DataMatrix symbol using font-based approach. You first create the barcode string (which is an array of text lines). Format the barcode string with MRV DataMatrix5 font you get the barcode.

The font characteristics are listed as below:

Table 2.2. DataMatrix Font Characteristics

FilenameTypefaceModule With (under 6 points)
mrvdatamatrix5.ttfMRV DataMatrix520 mils (0.5mm) Encoding

To create a valid barcode, you need to call an encoder to get a special string, and format this string with our DataMatrix font. To get this string, you need to call an encoder - you can run DataMatrix Encoder GUI, and obtain the result from this GUI program. Or if you need to bulk generate the results, using the programming interface exposed from the encoder DLL.

DataMatrix Encoder GUI

This GUI program allows you to quickly create barcode string and transfer it to other programs. You are able to enter the data encoded, and create the barcode on the fly. For more information, see Chapter 3, Using DataMatrix Encoder GUI.


This DLL is a standard Windows DLL that can be called by many programming environments, including Microsoft Office, C++, FoxPro and .Net. Most programming environments support Windows DLL directly. We provide a VBA module and a C# class that wrap around the DLL functionality.


This DLL is specifically designed for Crystal Reports. For more information on using the software with Crystal Reports, see Chapter 6, Adding DataMatrix to Crystal Reports.

2.2.2. Image File Based

You can export barcodes as standard image files to be consumed in other word processing and imaging programs. The DataMatrix Encoder GUI supports exporting images in four formats via a GUI interface. The Encoder DLL and DataMatrix ActiveX Control also provides programming interfaces to export images in those formats:

  • PNG (Portable Network Graphics)

  • BMP (Windows Bitmap File)

  • EMF (Ehanced Meta File)

  • SVG (Scalable Vector Graphics)

  • EPS (Encapsulated PostScript)

Special attention should be paid when the target printer has has low resolution, such as a thermal printer or fax machine. When generating vector graphics files, the software allows you to specify target dpi which you should set to the one that matches your printer. It is generally not recommended to scale the image down or up when working with low-resolution printers.

2.2.3. ActiveX Control

Many environments support ActiveX Controls, such as Microsoft Word, IE and Excel. You can insert the DataMatrix ActiveX Control into documents, spreadsheets, or invokes the control at the background in your program. Unlike standard image formats which does not contain encoding parameters, such as size and data encoded, ActiveX control keeps those info. Therefore you can change the data matrix by editing the properties.

Using ActiveX Control in Microsoft Office programs is straightforward. Programming knowledge is required in order to integrate the control with your custom programs.