Java Barcode Generator, .NET Barcode Generator for C#, ASP.NET, VB.NET
HOME PURCHASE SITEMAP COMPANY

Home > .NET Barcode > Barcode Generation Guide > .NET Data Matrix Generator for .NET, ASP.NET, C#, VB.NET

Download C#, .NET, VB.NET Barcode

.NET Data Matrix Generator for ASP.NET, C#, VB.NET

Data Matrix Bar Code Generation Guide in .NET, C#, ASP.NET, VB.NET

  • Easily generate Data Matrix barcodes in .NET applications
  • Compatible with the latest Data Matrix ISO specification [ISO/IEC 16022 (Second edition 2006-09-15)]
  • Generate high quality Data Matrix images in JPEG, GIF & PNG formats
  • 100% build in C#, compatible with .net 2.0 and later version
  • Generate Data Matrix barcodes using C#, VB.NET on ASP.NET or Windows Forms
  • Generate Data Matrix in Crystal Reports using C#, VB.NET
  • Generate Data Matrix in Reporting Service using C#, VB.NET
  • Mature .NET Barcode Generator component since 2003
  • Royalty-free and perpetual developer license


Quick Navigate

 

1. .NET Data Matrix Introduction

Data Matrix is also known as Data Matrix, ECC200.

Compatibility: Barcode for .NET component is compatible with ISO/IEC 16022 (Second edition 2006-09-15)

DataMatrix is a two-dimensional (2D) barcode symbology which can store from 1 to about 2,000 characters.
DataMatrix ECC200 version supports advanced encoding error checking and correction algorithms (reed-solomon). Those algorithms allow the recognition of barcodes that are up to 60% damaged.

DataMatrix is being used to encode product and serial number information on electrical rating plates; to mark of surgical instruments in Japan; to identify lenses, circuit boards, and other items during manufacturing.
Barcode Library supports all DataMatrix Formats and the data represented in the symbol can be compressed using one of following algorithms.
  • ASCII (0): it is used to encode data that mainly contains ASCII characters (0-127). This is the default encoding format by Barcode Library.
  • C40 (1): it is used to encode data that mainly contains numeric and upper case characters.
  • Text (2): it is used to encode data that mainly contains numeric and lower case characters.
  • Base256 (3): it is used to encode 8 bit values.

Sample of a DataMatrix Barcode


 

2. .NET Data Matrix Encoding Data Scope

Data Matrix Barcode for .NET, ASP.NET supports:
  • all 128 characters of ASCII


 

3. How to Generate Data Matrix Barcode Image in IIS without Visual Studio .NET?

  • Under downloaded trial package, copy barcode folder to your IIS folder, e.g. C:\Inetpub.
  • Create a new virtual directory in IIS, named barcode, and link to the above "barcode" folder.
  • Restart IIS.
  • To test your installation, open your web browser and navigate to
    http://YourDomain:Port/barcode/datamatrix.aspx?Data=123456789012
  • To create barcode image in your aspx or html page, you need pass the url to IMG tag src value.

    For example:
    <img src="http://YourDomain:port/barcode/datamatrix.aspx?Data=123456789012" />

    Using this method, it will not generate any barcode images in your IIS server side.


 

4. How to Generate Data Matrix Barcode Image through ASP.NET Web Form Control?

  1. Install .NET Barcode Controller to your ASP.NET project.
    1. Add Reference BarcodeLib.Barcode.dll to your project.
      Do not copy the dll to the bin directory, Visual Studio will do so, during project compilation time.
  2. Add barcode library to your Visual Studio Toolbox.
    1. Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
    2. Right click Toolbox, click menu Choose Items...
    3. Goto .NET Framework Components tab.
    4. If no BarcodeLib component found, click Browse... button and select BarcodeLib.Barcode.dll file.
    5. Then sort "Namespace" column, you will find 8 components from BarcodeLib.Barcode.
    6. Check component DataMatrixWebForm, and its namespace is BarcodeLib.Barcode.DataMatrix
    7. Click "OK" button, you will find four components under "General": DataMatrixWebForm.
  3. Go to "barcode" folder in the trial package, copy file "datamatrix.aspx" to the same folder as your aspx page, which will generate barcodes.
  4. You can drag DataMatrixWebForm on your aspx page in design view, change barcode setting through properties window.
  5. Run the project, you will find barcode images generated in your aspx pages.


 

5. How to Generate Data Matrix Barcode Image through .NET Windows Form Control in C# or VB.NET?

  1. Add Reference BarcodeLib.Barcode.dll to your project. Do not copy the dll to the bin directory, Visual Studio will do so, during project compilation time.
    1. In your .NET windows project, right click mouse over Refereces in your Solution Explorer window. Then click menu "Add Reference ...".
    2. Add BarcodeLib.Barcode.dll to your project.
  2. Add barcode library to your Visual Studio Toolbox.
    1. Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
    2. Right click Toolbox, click menu Choose Items...
    3. Goto .NET Framework Components tab.
    4. If no BarcodeLib component found, click Browse... button and select BarcodeLib.Barcode.dll file.
    5. Then sort "Namespace" column, you will find 8 components from BarcodeLib.Barcode.
    6. Check component DataMatrixWinForm, and its namespace is BarcodeLib.Barcode.DataMatrix
    7. Click "OK" button, you will find the control under "Common Controls": DataMatrixWinForm.
  3. Now you can see the component displayed on Toolbox. You can drag DataMatrixWinForm on your form, change barcode setting through properties widnow.


 

6. How to Generate Data Matrix Barcode Image in .NET, C# or VB.NET class?

  1. Add Reference BarcodeLib.Barcode.dll to your .NET project (ASP.NET website, Forms, any .NET project)
    In your .NET class.
    	BarcodeLib.Barcode.DataMatrix.DataMatrix barcode = new BarcodeLib.Barcode.DataMatrix.DataMatrix();
    	
    	barcode.Data = "123456789012";
    	
    	barcode.ModuleSize = 3;
            barcode.LeftMargin = 0;
    	barcode.RightMargin = 0;
    	barcode.TopMargin = 0;
    	barcode.BottomMargin = 0;
    	
    	barcode.Encoding = BarcodeLib.Barcode.DataMatrix.DataMatrixEncoding.ASCII;
    
            barcode.Format = BarcodeLib.Barcode.DataMatrix.DataMatrixFormat.Auto;
    	
    	// more barcode settings here
    	                        
    	// save barcode image into your system
    	barcode.drawBarcode("c:/barcode.png");
    	
    	// generate barcode & output to byte array
    	byte[] barcodeInBytes = barcode.drawBarcodeAsBytes();
    	
    	// generate barcode to Graphics object
    	Graphics graphics = ...;
    	barcode.drawBarcode(graphics);
    	
    	// generate barcode and output to HttpResponse object
    	HttpResponse response = ...;
    	barcode.drawBarcode(response);
    	
    	// generate barcode and output to Stream object
    	Stream stream = ...;
    	barcode.drawBarcode(stream);
    
Above code written in C# 2005


 

7. How to Save Data Matrix Barcode Image using .NET Barcode Generator Windows Control?

In Windows Controller, just call method SaveAsImage(string filename). e.g. SaveAsImage("C:\barcode.gif");


 

8. .NET Data Matrix Property Settings

  • Set the Data property with the value to encode.
    Type is string.
    • Valid Data Scope:
      • all 128 characters of ASCII
    • Sample: "123456789012"
    Web Stream URL Parameter: Data.
  • Set the BinaryData property with the binary value to encode. Type is byte[]. Once this property value is not null, barcode library will encode this value instead of property Data's value.
  • Set the Encoding property. Valid value is DataMatrixEncoding.ASCII (default), DataMatrixEncoding.C40, DataMatrixEncoding.Text, DataMatrixEncoding.Base256.
    • ASCII (0): it is used to encode data that mainly contains ASCII characters (0-127).
    • C40 (1): it is used to encode data that mainly contains numeric and upper case characters.
    • Text (2): it is used to encode data that mainly contains numeric and lower case characters.
    • Base256 (3): it is used to encode 8 bit values.
    Web Stream URL Parameter: Encoding. Values: ascii, c40, text, base256
  • Set the Format property for Data Matrix data mode format. Specifies the Data Matrix Format to use on that barcode.
    Type is DataMatrixFormat. Default is DataMatrixFormat.Auto.
    Web Stream URL Parameter: Format. Values: (int)DataMatrixFormat
  • Barcode Size Settings:
    • Set property UOM (Unit of Measure) for properties BarWidth, BarHeight, LeftMargin and TopMargin.
      Valid values are UnitOfMeasure.Pixel (0), UnitOfMeasure.CM (1), UnitOfMeasure.Inch (2).
      Default is UnitOfMeasure.Pixel (0).
      Web Stream URL Parameter: UOM. Valid values are: 0, 1, 2.
    • Set the ModuleSize (for bar cell width and height)
      Type is float.
      Default is 3 pixels.
      Web Stream URL Parameter: ModuleSize.
    • Set the LeftMargin, RightMargin, TopMargin and BottomMargin properties.
      Types are all float. Default are 0.
      Web Stream URL Parameter: LeftMargin, RightMargin, TopMargin, BottomMargin.
    • Set the Resolution property (Value is expressed in DPI - Dots per inch).
      Type is int. Default is 96 dpi.
      Web Stream URL Parameter: Resolution.
  • Set the ImageFormat property for barcode image type.
    Type is System.Drawing.Imaging.ImageFormat.
    Default value is ImageFormat.Png.
    Web Stream URL Parameter: ImageFormat. Valid values are: gif, jpeg, png, bmp, tiff.
  • Set the ProcessTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true.
    • ~1: is used to represent the FNC1 code
    • ~2: is used to represent the Structured Append and must be followed by a 3-digit number between 1 and 255
    • ~3: is used only at the very beginning of the symbol for the reader programming purpose.
    • ~5: is used only at the very beginning of the symbol, the header [)> + ASCII 30 + ASCII 05 + ASCII 29 will be transmitted by the barcode reader before the data in the message and the trailer ASCII 30 + ASCII 4 will be transmitted afterwards.
    • ~6: is used only at the very beginning of the symbol, the header [)> + ASCII 30 + ASCII 06 + ASCII 29 will be transmitted by the barcode reader before the data in the message and the trailer ASCII 30 + ASCII 4 will be transmitted afterwards.
    • ~7NNNNNN: is used to specify the Extended Channel and NNNNNN is a value between 000000 and 999999.
    • ~dNNN: is used to represent the ASCII character with the value of NNN.
    Web Stream URL Parameter: ProcessTilde. Valid values are: "true", or "false".


Download C#, .NET, VB.NET Barcode






   Copyright 2010 BarcodeLib.com. Provides High Quality .NET Barcode, Barcode .NET, C# Barcode, ASP.NET Barcode, VB.NET Barcode, Data Matrix .NET, .net datamatrix, .net data matrix, datamatrix .net, Data Matrix ASP.NET, c# data matrix, vb.net data matrix. All rights reserved.