KA.Barcode Generator for .NET Suite
How to Create & Resize Data Matrix in C#
Complete C#.NET source code to generate Data Matrix images and change barcode size with .NET Control

C# Data Matrix Generator: create, generate, render data matrix code with free open source c# example code



  • Full integration into .NET, compatible with Microsoft .NET Framework 2.0, 3.0, 3.5 and above versions
  • Draw and print barcode .NET, barcode Word, barcode .NET WinForms & barcode ASP.NET in .NET IDEs
  • Print, create high-quality Data Matrix in Windows forms, initegrate images in ASP.NET web sites and Crystal Reports
  • .NET barcode creator for drawing two-dimensional Data Matrix images in C#.NET class library
  • 30 Data Matrix Format Mode (square or rectangular) to choose from for Data Matrix generation
  • Simple to adjust Data Matrix barcode module width / X dimension, and bar height / Y dimension
  • Support Data Matrix surrounding margins/quiet zones setting and image generation
  • Implementing dynamic barcodes, like ISBN ASP.NET, Word Intelligent Mail, Code 128 .NET WinForms, QR Code C# in your projects
  • Draw, print Data Matrix images with three available units of measure: cm, pixel, and inch
  • Generating, creating Data Matrix compatible with ISO/IEC 16022 and GS1 General Specifications
Data Matrix is a 2-dimensional barcode symbology also named ECC200, 2D Data Matrix Barcode. KA.Barcode Generator for .NET Suite is a best barcode creator control API featuring 2D Data Matrix creating & drawing in NET projects using C# programming. You can easily adjust image size through Data Matrix X, Y, barcode width and barcode height settings. This guide will help you create Data Matrix with ideal size. Check out two more tutorials with samples below!
Install KA.Barcode Generator for .NET Suite into C#.NET Project
  1. 1.
  2. 2.
    Add Reference: Add "KeepAutomation.Barcode.Window.dll" to your C#.NET project reference.
How to Generate, Resize Data Matrix Barcode Images in C# Class
Copy the following C#.NET program into .NET project to create, integrate a Data Matrix barcode image.
using KeepAutomation.Barcode.Bean;

BarCode datamatrix= new BarCode();
datamatrix.Symbology = KeepAutomation.Barcode.Symbology.DataMatrix;
datamatrix.CodeToEncode = "DataMatrixImage";
datamatrix.X = 3;
datamatrix.Y = 3;
datamatrix.generateBarcodeToImageFile("C:/datamatrix_csharp.png");
datamatrix-property

Data Matrix Barcode Unit

All Data Matrix barcode size settings are measured in a specific unit. KA.Barcode Generator for .NET Suite provides three units of measure for you to choose: Cm, Inch and Pixel. Default value is in Pixel. You can adjust it through the following demo code.
datamatrix.BarcodeUnit = BarcodeUnit.Pixel;
How to create barcode in C#.NET using Client Report RDLC? ....
A professional barcode generator control SDK library, KA.Barcode for .NET Suite include complete and strong functionality for high-quality QR Code...
Procedures for .NET Barcode Control Installation. ....
more>

Data Matrix Module Width and Module Height (X and Y dimension)

Data Matrix X dimension refers to the width of the module bar in a Data Matrix barcode image. This value type is float with a 1 pixel minimum value, which is the default value in KeepAutomation .NET Data Matrix Barcode.

Y dimension refers to the height of the module bar for a Data Matrix image. Since Data Matrix is made up of tiny square modules, users are required to set X and Y into the same value.
datamatrix.X = 3;         
datamatrix.Y = 3;

Data Matrix Format Mode

A Data Matrix size is largely decided by the Data Matrix Format Mode, which refers to the number of modules in a Data Matrix image. Default value is 12x12 for KA.Barcode Generator for .NET Suite.

Data Matrix symbols have 24 sizes of the square format ranging from 10x10 to 144x144 modules, not including the 1-X surrounding quiet zone (margin). The rectangular format has 6 sizes from 8x18 up to 16x48 modules, not including quiet zone. Adjust through the following setting.
datamatrix. DataMatrixFormatMode = DataMatrixFormatMode.FM_12X12;

Adjust Data Matrix Margins / Quiet Zones

The specification requires a 1-X margins, i.e. quiet zones, on four sides of a Data Matrix to increase readability. You can adjust width of the margin by increasing the value of properties LeftMargin (Float; Default: 0), RightMargin (Float; Default: 0), TopMargin (Float; Default: 0) and BottomMargin (Float; Default: 0). Please note that if you set X = 3, then you should set margin as follows:
datamatrix.TopMargin = 3;
datamatrix.BottomMargin = 3;
datamatrix.LeftMargin = 3;
datamatrix.RightMargin = 3;

Data Matrix Fixed BarCode Height and BarCode Width

C#.NET Data Matrix Generator is also equipped with functional properties BarCodeHeight (Float; Default: 0) and BarCodeWidth (Float; Default: 0) to set the size of the Data Matrix bar code image.
datamatrix.BarCodeHeight = 70;
datamatrix.BarCodeWidth = 175;