Data matrix code offers high data density in a small size, which makes it an ideal choice for space-limited scenarios. In some scenarios, you might want to create a data matrix code to store information in the form of contrasted cells arranged in a grid. In accordance with such requirements, this article covers how to generate a data matrix code programmatically in C#.
- C# API to Generate Data Matrix Code
- Generate Data Matrix Code in C#
- Generate Data Matrix ECC200 Code in C#
C# API to Generate Data Matrix Code
We will use the Aspose.BarCode for .NET API to generate data matrix code in C#. It supports generating or scanning different 1D and 2D barcodes.
Please download the DLL of the API or install it using the following NuGet command:
PM> Install-Package Aspose.BarCode
Generate Data Matrix Code in C#
We can easily generate a data matrix code by following the steps below:
- Create an object of the BarcodeGenerator class and set the EncodeType.
- Set the pixels and encode mode for the Data Matrix code.
- Save the output data matrix code by exporting it as a PNG image.
The following code sample shows how to generate a data matrix code in C#:
Generate Data Matrix ECC200 Code in C#
Similarly, we can generate a data matrix for the ECC200 code by following the steps below:
- Instantiate an object of the BarcodeGenerator class and pass the input text and EncodeType as parameters.
- Set the pixels and data matrix to ECC type.
- Write the Data Matrix ECC200 barcode using the Save method.
The code snippet below shows how to generate a Data Matrix ECC200 barcode in C#:
Get a Free License
Interested in evaluating the API without any evaluation limitations? If yes, then you can request a free temporary license.
Conclusion
In this article, you have explored how to generate a data matrix code with different encodings like ECC200, ECC000, ECC050, etc. along with other variations of the data matrix code. You may take a look at other features by visiting the documentation space. Please do not hesitate to get in touch with us at the forum in case of any queries.