C#. Data Matrix Generator Size Setting Tutorial

sample source code to generate 2D Data Matrix images and adjust barcode size in C# .NET

  • Easy to create Data Matrix barcodes in .NET applications using Visual C# class library
  • Completely run in Visual C#.NET development environments, including Winforms applications, ASP.NET web forms, Crystal Reports, SSRS and C#.NET class & console applications
  • Make Data Matrix barcodes according to the latest Data Matrix specification - ISO / IEC 16022 (2nd edition 2006-09-15)
  • Support GS1 system standard for Data Matrix generation
  • Simple to encode all ASCII characters using 7 different data mode
  • Provide 24 square and 6 rectangular Data Matrix barcode size ranging from 8X8 to 144X144
  • Easy to control, modify Data Matrix barcode using 50+ barcode settings provided
  • Light-weight, user-friendly Data Matrix barcode component used world-widely
  • Tutorial for Data Matrix Image Setting in Visual C#.NET
  • Tutorial for Data Matrix Data Encoding in Visual C#.NET

Data Matrix, also known as Data Matrix ECC200, is great 2-dimensional matrix barcode to store different data up to 2,335 alphanumeric characters.

How to generate, print barcode using .NET, Java sdk library control with example project source code free download:

Data Matrix Structure

Data Matrix Image Width Related Settings

W: the width of Data Matrix image (including quiet zone). Please see BarCodeWidth.

X: the width of Data Matrix module. Xmin=1 pixel. Please see X.

Q: the width of the quiet zone; Qmin=X. Please see Left & Right Margin.

Format Mode: the version of Data Matrix, ranging from 8X8 to 144X144. Please see Data Matrix Format Mode.

Data Matrix Image Height Related Settings

H: the height of Data Matrix image (including quiet zone). Please see BarCodeHeight.

Top & Bottom Margin: the height of the top & bottom quiet zone. Please see Top & Bottom Margin.

Format Mode: the version of Data Matrix, ranging from 8X8 to 144X144. Please see Data Matrix Format Mode.


Setting Data Matrix Barcode Size in C#

C# Data Matrix barcode provides a set of barcode size settings to specify you Data Matrix barcodes. Please download C# barcode component and install, copy those following code to your Visual Studio:

DataMatrix barcode = new DataMatrix();

barcode.DataMatrixDataMode = DataMatrixDataMode.Auto;

barcode.Data = "ONBARCODE";

Modify your Data Matrix barcodes by setting those following properties:


UOM is short for Unit of Measure, which is the unit of meature for all size related settings in the library. C# Data Matrix barcode provides 3 options: Pixel, Cm, and Inch. The default is Pixel.

barcode.UOM = UnitOfMeasure.PIXEL;

Data Matrix Format Mode

DataMatrixFormatMode is the different size of Data Matrix. C# Data Matrix barcode provides 30 types version: 24 square ones with sizes from 10x10 to 144x144 (even values only) not including quiet zones; and 6 rectangular ones with sizes from 8x18 to 16x48 not including quiet zones. The default in C# Data Matrix barcode is DataMatrixFormatMode.Format_10X10.

barcode.DataMatrixVersion = DataMatrixVersion.Format_144X144;

Barcode Width & Height

BarcodeWidth is the Data Matrix barcode image width. The default in C# Data Matrix barcode is 0 (float).

BarcodeHeight is the Data Matrix barcode image height. The default in C# Data Matrix barcode is 0 (float).

barcode.BarcodeWidth = 0;

barcode.BarcodeHeigth =0;

Notice: if your setting is smaller than the barcode required minimum width and height, the library will automatically reset to barcode minimum width. Or you may enable AutoResize to automatically resize your Data Matrix barcode image.

Barcode Margin

BarcodeMargin is the white zone around the Data Matrix symbol. C# Data Matrix barcode provides 4 options: Left Margin, Right Margin, Top Margin and Bottom Margin. The default of these four margins are 0 (float).

barcode.TopMargin = 3;

barcode.BottomMargin = 3;

barcode.LeftMargin = 1;

barcode.RightMargin = 1;


X is the width and height of barcode bar module. The default in C# Data Matrix barcode is 2 (float).

barcode.X = 3;

OnBarcode is a market-leading provider of barcode imaging generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides comprehensive tutorials and how-tos for various linear, 2d barcode information, such as C# in ASP.NET, C# .NET, C# Barcode Encoding, C# Barcode Image, VB.NET in ASP.NET, VB.NET Winforms, VB.NET Barcode Encoding. OnBarcode barcode products are supported by RasterEdge ASP.NET Document Viewer, which supports ASP.NET PDF Viewer, ASP.NET MVC Document Viewer, ASP.NET PDF Editor, MVC PDF Viewer. And provide high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.