To print
Data Matrix barcode in C#, you need both
bcsdatamatrix.ttf true type font and
cruflbcsn.dll .
To get cruflbcsn.dll, you can either download it from
data matrix Barcode C# ,
or you can generate cruflbcsn.dll if you already have cruflbcs.dll.
tlbimp is a utility of Windows SDK. It converts type definitions of a COM object to equivalent definitions in a common language runtime assembly that you can use in C#.
tlbimp cruflbcs.dll /out:cruflbcsn.dll
Most updated cruflbcs.dll can be download from the following URL:
data matrix barcode C#.
Print Data Matrix Barcode In C#
Add reference to cruflbcsn.dll from your C# project first.
Then use code snippet below to get Data Matrix barcode in C#
using cruflbcsn;
cruflbcsn.IDatamatrix pDatamatrix = new CDatamatrix();
textBox2.Text = pDatamatrix.Encode(textBox1.Text);
Or you can use code snippet below to customize a Data Matrix barcode in C#
using cruflbcsn;
cruflbcsn.IDatamatrix pDatamatrix = new CDatamatrix();
textBox2.Text = pDatamatrix.EncodeCR(textBox1.Text, 0, 0, 0, 0);
The first parameter is string to encode.
The second parameter is index. Always set it to zero please.
The third parameter of the formula is Format. Its values range between 0 and 30. When set to zero, it means auto-selected format.
The fourth parameter is Encodation method. Its values range between 1 and 6 which stand for the following encodation separately: ASCII, C40, TEXT, X12, EDIFACT, BASE256.
The fifth parameter is GS1 indicator. It is a Boolean indicating whether this is a GS1-compliant barcode. Set it to zero when this is not GS1-datamatrix compliant.