// 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");
' 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")
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:
|
GraphicsUnit | graphics-unit | GraphicsUnit.Pixel | The unit of measurement for all size related settings.
|
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:
|
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.
|
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 |