New to Telerik UI for .NET MAUIStart a free 30-day trial

DataMatrix

The Data Matrix barcode is a two-dimensional type of code used in industry for marking small parts and items due to its high data density and reliability.

Visual Structure

Data Matrix code consists of dark and light square cells that form a matrix. The produced code can be square or rectangular and can have size up to 144x144 for square codes or 16x48 for rectangular codes. To provide readability, the Data Matrix code includes error correction algorithm, allowing to reconstruct up to 30% of damaged code image.

A Data Matrix Barcode

Barcode DataMatrix

  • Finder pattern—The L-shaped lines at the bottom and left of the code are called "finder pattern". It's used by the readers for orientation, customization, and correcting distortion.

  • Module size—the smallest cell in the code graphical representation. The module size is recommended to be 2x2 printed dots for readability.

  • Timing pattern—The lines at the top and right of the code are called "timing pattern". It provides information about the barcode size.

  • Data area—The area surrounded by the finding pattern and timing pattern. Contains the modules that encode the barcode contents.

The size of the Data Matrix code depends on module size, length and type of its contents. The contents type determines if the encoded value contains only numerical characters or includes ASCII or Unicode characters. The following table shows the correlation between the content type, content length and matrix size:

COUNT OF NUMERICAL CHARACTERSCOUNT OF ASCII CHARACTERSMATRIX SIZE
6310x10
10612x12
161014x14
241616x16
362518x18
443120x20
604322x22
725224x24
886426x26
1249132x32

Encodation

The encodation determines the type of contents encoded by the Data Matrix barcode. Choosing a proper encodation imposes validation rules, but reduces the barcode size and improves its readability.

The following table lists the supported Data Matrix encodations and provides information about their restrictions and data storing requirements.

EncodationRequirements
ASCIIThe allowed characters include double-digit numerics and all values from the ASCII table. The double-digit numerics use four bits. The ASCII values in the 0-127 range use eight bits. The ASCII values in 128-255 range use 16 bits.
C40Used primarily for upper-case alphanumerics. The upper-case alphanumeric characters use 5.33 bits. The lower-case and special characters use 10.66 bits.
TextUsed primarily for lower-case alphanumerics. The lower-case alphanumeric characters use 5.33 bits. The upper-case and special characters use 10.66 bits.
X12Uses the characters from ANSI X12 EDI data set. Each character takes 5.33 bits.
EDIFACTUsed to encode ASCII values in the 32-94 range. Each character takes six bits.
Base256Used to encode characters in the whole ASCII range. Each character takes eight bits.
AsciiGS1Used to encode FNC1 characters in the ASCII range.

Symbol Size

The SymbolSize property sets the symbol size and shape of the generated barcode. It can be automatically determined by using SquareAuto or RectangleAuto, or specific like Square32x32 or Rectangle16x48.

Text Encoding

The TextEncoding property determines the character encoding that is used to encode the barcode contents. By default, TextEncoding is UTF-8, which uses more bits per character and may increase the size of the barcode image.

Example

1. Add the Barcode definition:

xaml
<telerik:RadBarcode x:Name="Barcode"                                 
                    Value="https://www.telerik.com/maui-ui">
    <telerik:RadBarcode.Symbology>
        <telerik:DataMatrix Encodation="Ascii"
                            SymbolSize="SquareAuto"/>
    </telerik:RadBarcode.Symbology>
</telerik:RadBarcode>

2. Add the telerik namespace:

XAML
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"

Here is the result:

Barcode DataMatrix

See Also