.NET Data Matrix barcode generator for c#, vb.net
How to generate, print data matrix 2d barcode label using c#, vb.net, in asp.net, winodws application, with free c# example


Free c#, vb.net examples to generate, print data matrix 2d barcode in asp.net, c#, vb.net, crystal reports.



  • Fully compatible with ISO/IEC 16022 (2nd edition) for valid Data Matrix output
  • Barcode creation control entirely developed in managed C#.NET
  • Completely integrate with Microsoft Visual Studio 2005/2008/2010
  • 2D Data Matrix barcode image generation in .NET applications
  • Provide complete developer guide for 2D Data Matrix generation in .NET
  • Advanced and reliable 2D Data Matrix barcode generating DLL used world-wide
  • Provide royalty-free and perpetual developer licenses for customers
Data Matrix Generator for .NET Overview
Data Matrix Generator is barcode generation functionality included in KA.Barcode for .NET Suite that can integrate professional 2D Data Matrix barcode images in .NET Windows applications, ASP.NET web pages, Crystal Reports, SSRS, and other .NET projects.

barcodelib.barcode.rdlc reports.dll, ean 13 barcode generator c# free, c# barcode generator wpf, how to insert barcode in crystal report, how to generate qr code in asp.net using c#, barcode scan camera c#
2D Data Matrix Barcode Introduction
Data Matrix is a two-dimensional (2D) barcode symbology used in many industries. It is recommended by the United States' Electronic Industries Alliance (EIA) for labeling small electronic components. Data Matrix is the only 2 dimensional barcode defined in GS1 System of Standards.
Data Matrix Encodable Characters
  • Standard ASCII characters: 0-127 including A-Z, a-z, 0-9 and special characters
  • Extended ASCII characters: 128-255
Download .NET Data Matrix Barcode Generator
We offer free trial package download of KA.Barcode for .NET Suite to allow valid Data Matrix barcode generation in .NET projects. Useful items are included in the unzipped package(KeepAutomation.Barcode.Crystal.dll, KeepAutomation.Barcode.Crystal.dll, KeepAutomation.Barcode.SSRS2005.dll, KeepAutomation.Barcode.SSRS2005CRI.dll, KeepAutomation.Barcode.SSRS2008.dll, KeepAutomation.Barcode.SSRS2008CRI.dll, KeepAutomation.Barcode.Web.dll and KeepAutomation.Barcode.Windows.dll).
Generate Data Matrix Barcode in .NET Using C# or VB.NET
  1. Move to the Visual Studio Solution Explorer window, and add "KeepAutomation.Barcode.Windows.dll" or "KeepAutomation.Barcode.Web.dll" as reference of the project.
  2. Use the following C# or VB sample code to generate Data Matrix barcode image.
C# Sample code
     BarCode datamatrix = new BarCode();
datamatrix.Symbology = KeepAutomation.Barcode.Symbology.DataMatrix;
datamatrix.CodeToEncode = "Data Matrix";
datamatrix.X = 3;
datamatrix.Y = 3;
datamatrix.generateBarcodeToImageFile("c://barcode-datamatrix-csharp.png");

VB Sample code
     Dim datamatrix As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

datamatrix.Symbology = KeepAutomation.Barcode.Symbology.DataMatrix
datamatrix.CodeToEncode = "Data Matrix"
datamatrix.X = 3
datamatrix.Y = 3
datamatrix.generateBarcodeToImageFile("c:/barcode-datamatrix-vbnet.png")

Generate Data Matrix Barcode in ASP.NET Project
  1. Unzip the downloaded .NET Data Matrix barcode generator trial package.
  2. Open your Visual Studio to create a new ASP.NET project and copy "barcode.aspx" and "barcode.aspx.cs" in "barcode" folder to your project folder.
  3. Browse and select "KeepAutomation.Barcode.Web.dll" and add it to your project reference.
  4. Drag and drop "BarCodeControl" in Toolbox to the aspx page for your Data Matrix barcode generation.
  5. Select DataMatrix barcode symbology in Properties window.
  6. Debug and you will see the generated Data Matrix barcode image.
Data Matrix barcode image generation in Microsoft Internet Information Services
  1. Unzip the downloaded trial package and copy the "barcode" folder in it to your IIS web application folder.
  2. Establish a virtual directory (named as "barcode") in your IIS and restart it.
  3. Open your browser and navigate to:
    "http://YourDomain:port/barcode/barcode.aspx?symbology=101&code-to-encode=0123456789&x=3&y=3".
  4. Or you can also use the following image tag to insert barcodes in html or aspx pages:
    <img src="barcode/barcode.aspx?symbology=101&code-to-encode=0123456789&x=3&y=3"/>
  5. Reset properties of the generated Data Matrix barcode image in the above URL.
Generate Data Matrix Barcode in .NET WinForms
  1. Locate KeepAutomation.Barcode.Windows.dll to the Toolbox in your Visual Studio.
  2. Then, drag and drop the BarCodeControl from the Toolbox into the form.
  3. Switch to the Properties window and change "Symbology" to "DataMatrix".
  4. Now, you can see the created Data Matrix barcode image.
  5. Or you can also customize your Data Matrix barcode image through the Properties window.
Generate Data Matrix Barcode in .NET Reports

Detailed Guide for Generating 2D Data Matrix Barcode Image in Crystal Reports
With this 2D Data Matrix barcode generation guide, uses can easily insert user-defined Data Matrix barcode image in Crystal Reports.
Detailed Guide for Generating 2D Data Matrix Barcode Image in RDLC Reports
With this 2D Data Matrix barcode generation guide, uses can easily insert user-defined Data Matrix barcode image in RDLC Reports.
Detailed Guide for Generating 2D Data Matrix Barcode Image in Reporting Services
With this 2D Data Matrix barcode generation guide, uses can easily insert user-defined Data Matrix barcode image in Reporting Services.
Data Matrix Property Settings
Class Attribute HTTP Attribute Default Value Note
Basic
Symbology symbology Code128Auto Barcode symoblogy type
CodeToEncode code-to-encode "128" Barcode value to encode.
ChecksumEnabled checksum-enabled false It is not applied for Data Matrix
ImageFormat image-format ImageFormat.Png Barcode encoded image format.
Barcode Size
AutoSizeAdjust auto-size-adjust false If true, barcode X, Y module will be auto-adjusted.
BarcodeUnit barcode-unit BarcodeUnit.Pixel Unit of measure for all size related settings. 0: pixel; 1: inch; 2: cm.
X x 1 Barcode module width (narrow bar).
Y y 50 Linear barcode bar height / 2D barcode module height.
LeftMargin left-margin 0 Barcode image left margin.
RightMargin right-margin 0 Barcode image right margin.
TopMargin top-margin 0 Barcode image top margin.
BottomMargin bottom-margin 0 Barcode image bottom margin.
DPI dpi 72 Barcode image resolution in dpi.
Orientation orientation Orientation.Degree0 Barcode rotation angle.
BarCodeWidth barcode-width 0 Whole barcode width.
BarCodeHeight barcode-height 0 Whole barcode height.
2D / Matrix Group Barcode Properties
GroupEnabled group-enabled false Set to enable Data Matrix, PDF417, or QR Code group function.
GroupItemCount group-item-count 0 Data Matrix, PDF417, or QR Code group count.
GroupItemId group-item-id 0 Data Matrix, PDF417, or QR Code group item id.
GroupId group-item-id 0 Data Matrix, PDF417, or QR Code group item.
Data Matrix Specific Settings
DataMatrixDataMode data-matrix-data-mode DataMatrixDataMode.Auto Set Data Matrix data encoding mode.
  • DataMatrixDataMode.Auto: KeepAutomation will select proper data format according to your encoding value.

  • DataMatrixDataMode.ASCII: All ASCII characters, including 0-9, A-Z, a-z and special characters like $ , % + / : * etc.

  • DataMatrixDataMode.C40: 0-9, A-Z

  • DataMatrixDataMode.Text: 0-9, a-z

  • DataMatrixDataMode.X12: 0-9, A-Z, and some punctuation marks.

  • DataMatrixDataMode.Edifact: 0-9, A-Z, many punctuation marks

  • DataMatrixDataMode.Base256: to encode images, double-byte characters, binary data and 8 bit values.
DataMatrixFormatMode data-matrix-format-mode DataMatrixFormatMode.FM_12X12 Set Data Matrix format mode, including 24 square and 6 rectangle formats.
FNC1 fnc1 FNC1.None To encode GS1 compatible Data Matrix, you need set value to "FNC1.First"
TildeEnabled tilde-enabled false Set TildeEnabled to true, specifying special characters in barcode data.

Support escape '~' for data message
  • 1-byte character: ~ddd (character value from 0 ~ 255)
    ASCII (with EXT): from ~000 to ~255

    For example, ASCII char [GS] is non-printable, and its decimal value is 29. In barcode data, you need use ~029 for char [GS].

  • 2-byte character: ~6ddddd (character value from 0 ~ 65535)

  • Unicode: from ~600000 to ~665535

  • ECI: from ~7000000 to ~7999999

  • SJIS: from ~9ddddd (Shift JIS 0x8140 ~ 0x9FFC and 0xE040 ~ 0xEBBF)
Data Matrix Barcode Generation in .NET Applications with C#
Here is the easiest way to encode barcodes with this barcode maker using Visual C# Class Library. What given below is detailed C# sample code to create Data Matrix barcodes in C# class, with all barcode properties available for adjustment. Copy the code to your project now and debug to view generated barcodes!
C# Sample code
     BarCode datamatrix = new BarCode();
datamatrix.Symbology = KeepAutomation.Barcode.Symbology.DataMatrix;

//Data Matrix encoding valid input: All ASCII characters, including 0-9, A-Z, a-z, special characters
datamatrix.CodeToEncode = "DataMatrix";

//KeepAutomation provides the following Data Matrix Barcode Data Formats:
//ASCII: All ASCII characters, including 0-9, A-Z, a-z and special characters like $ , % + / : * etc.
//Auto: KeepAutomation will select proper data format according to your encoding value.
//Base256: to encode images, double-byte characters, binary data and 8 bit values.
//C40: 0-9, A-Z
//Edifact: 0-9, A-Z, many punctuation marks
//Text: 0-9, a-z
//X12: 0-9, A-Z, and some punctuation marks.
datamatrix.DataMatrixDataMode = DataMatrixDataMode.Auto;
datamatrix.DataMatrixFormatMode = DataMatrixFormatMode.FM_12X12;

//Set Data Matrix image size
//Data Matrix Unit of measure, support pixel, cm and inch.
datamatrix.BarcodeUnit = BarcodeUnit.Pixel;
// Data Matrix image resolution in dpi
datamatrix.DPI = 72;
// Data Matrix bar module width (X dimention)
datamatrix.X = 3;
//Bar module height (Y dimention), Y=X
datamatrix.Y = 3;

//Data Matrix image left margin size(quiet zone), the minimum value is X.
datamatrix.LeftMargin = 9;
//Image right margin size, the minimum value is X.
datamatrix.RightMargin = 9;
datamatrix.TopMargin = 9;
datamatrix.BottomMargin = 9;
//Barcode image orientation, 0, 90, 180 and 270 degrees supported.
datamatrix.Orientation = KeepAutomation.Barcode.Orientation.Degree0;

//Generate Data Matrix barcodes in PNG image format
datamatrix.generateBarcodeToImageFile("C://barcode-datamatrix-csharp.png");

/* Create Data Matrix barcodes in Stream object
datamatrix.generateBarcodeToStream(".NET System.IO.Stream Object");

Draw & Print Data Matrix barcodes to Graphics object
datamatrix.generateBarcodeToGraphics(".NET System.Drawing.Graphics Object");

Generate Data Matrix barcodes & write to byte[]
byte[] barcodeInBytes = datamatrix.generateBarcodeToByteArray();

Generate Data Matrix barcodes & encode to System.Drawing.Bitmap object
Bitmap barcodeInBitmap = datamatrix.generateBarcodeToBitmap();
*/
How to Generate Data Matrix Using VB.NET? Complete Visual Basic Source Code
Users are allowed to use the following VB sample code to generate Data Matrix barcode image in .NET applications. They can also make some adjustment to the generated barcode image by resetting Data Matrix barcode properties. But users need to download this barcode control and add it to project reference at first.
VB Sample code
     Dim datamatrix As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode
datamatrix.Symbology = KeepAutomation.Barcode.Symbology.DataMatrix

'Data Matrix format mode, FM10X10 - FM144X144 supported.
datamatrix.DataMatrixFormatMode = KeepAutomation.Barcode.DataMatrixFormatMode.FM_12X12

'Data Matrix data mode, supporting ASCII, Auto, Base256, C40, Edifact, Text, X12.
datamatrix.DataMatrixDataMode = KeepAutomation.Barcode.DataMatrixDataMode.Auto

'Set Data Matrix valid input: All ASCII characters, including 0-9, A-Z, a-z, special characters. Length: variable.
datamatrix.CodeToEncode = "vbDataMatrixGenerator"

'Data Matrix unit of measure: pixel, cm and inch
datamatrix.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel
'Data Matrix image resolution in dpi
datamatrix.DPI = 72

'Data Matrix image size settings

'Data Matrix bar module width (X dimention), default is 1 pixel.
datamatrix.X = 3
'Data Matrix bar module height (Y dimention), Y=X
datamatrix.Y = 3
'Data Matrix image margin size, minimum value is X on all four sides according to specification.
datamatrix.LeftMargin = 3
datamatrix.RightMargin = 3
datamatrix.TopMargin = 3
datamatrix.BottomMargin = 3

'Generate and save Data Matrix in Png, Jpeg, Gif, Bmp, Tiff image formats.
datamatrix.ImageFormat = Drawing.Imaging.ImageFormat.Png
datamatrix.generateBarcodeToImageFile("C://datamatrix_in_vb.png")
Free Trial DownloadC#/VB Data MatrixFor Web Data MatrixFor Windows Data MatrixFor Reports Data MatrixUsing C#Using VB.NETPDF417 for .NETQR Code for .NETmoreCodabar for .NETCode 39 for .NETCode 128 for .NETEAN-8 for .NETEAN-13 for .NETEAN 128 for .NETIntelligent Mail for .NETInterleaved 2 of 5 for .NETISBN for .NETITF-14 for .NETRM4SCC for .NETUPC-A for .NETUPC-E for .NETmore
KeepAutomation provides complete barcode automation solutions. We recommend the customers use high quality document controls: ASP.NET Document Viewer, ASP.NET MVC Document Viewer, Document Viewer ASP.NET C#, ASP.NET PDF Viewer, ASP.NET Word Viewer, ASP.NET Excel Viewer, ASP.NET PDF Editor, MVC PDF Viewer, ASP.NET Annotate PDF, c# pdf sdk, C# View, edit PDF online , C# Convert PDF to Tiff, C# Convert PDF to text, txt, .net imaging sdk, C# PDF metadata edit from RasterEdge.com.