Generate Data Matrix Barcode using C#

This short guide describes how to generate data matrix barcode using C#. It has details to set the IDE, a list of steps, and sample code for developing a data matrix generator using C#. Various options will be discussed to customize the output data matrix barcode image.

Steps for Data Matrix Code Generator using C#

  1. Set the environment to use Aspose.BarCode for .NET for generating data matrix code
  2. Import the barcode generator library for working with the data matrix QR code
  3. Create the BarcodeGenerator class object, set the encode type to DataMatrix along with the text to be encoded
  4. Set the encoding mode to automatic for best encoding selection
  5. Select the ECC type to Ecc200 for better error handling and recovery
  6. Set the size of the barcode module and the resolution of the output image
  7. Save the resultant code as a PNG image

These steps summarize the process to develop a datamatrix maker using C#. Import the BarCode library, create a BarcodeGenerator object, set the encode type, text to be encoded, and set all the desired parameters. Finally, call the Save() method from the BarcodeGenerator class to generate the image by setting the image file name and image format.

Code for Data Matrix QR Code Generator using C#

This sample code demonstrates how to work with a datamatrix code generator using C#. To handle the specific print layouts, you may require a non-square module ratio that can be achieved by using the DataMatrix.AspectRatio parameter. For printing human-readable text alongside the barcode, use the CaptionAbove or CaptionBelow property.

This article teaches the process to create a 2D barcode of type datamatrix. To set a checksum for a barcode, refer to the article Set Barcode Checksum using C#.