Java Barcode Generator, .NET Barcode Generator for C#, ASP.NET, VB.NET
HOME BARCODE FOR ASP.NET PURCHASE


ASP.NET Barcode Developer Guide > ASP.NET Barcode Data Matrix Developer Guide

ASP.NET Data Matrix Barcode Property Settings



1. Generate Data Matrix in .NET Class

The following C#.net code illustrates how to generate a Data Matrix barcode in a C# class

	BarcodeLib.Barcode.DataMatrix barcode = new BarcodeLib.Barcode.DataMatrix();
	
	barcode.Data = "123456789012";

	barcode.UOM = UnitOfMeasure.PIXEL;
	barcode.ModuleSize = 3;
	barcode.LeftMargin = 0;
	barcode.RightMargin = 0;
	barcode.TopMargin = 0;
	barcode.BottomMargin = 0;

	barcode.Encoding = BarcodeLib.Barcode.DataMatrixEncoding.ASCII;

	barcode.Format = BarcodeLib.Barcode.DataMatrixFormat.Format_10X10;

	barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
	
	// 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);


2. Data Matrix Barcode 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 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: 0(ASCII), 1(C40), 2(Text), 3(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.Format_10X10.
    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 ImageWidth and ImageHeight properties.
      Both types are float.
      BarWidth default is 0 pixel.
      BarHeight default is 0 pixel.
      Web Stream URL Parameter: ImageWidth and ImageHeight.
    • 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 ResizeImage property to "true" and our component will resize the barcode image if manual setting is invalid.
      Type is bool. Default is false.
      Web Stream URL Parameter: Resolution.
    • 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 Color Related properties.
    • Set the BackgroundColor property. Barcode background color can be changed.
      Type is System.Drawing.Color. Default is BackgroundColor = Color.White.
      Web Stream URL Parameter: BackgroundColor.
    • Set the BarColor property. Barcode bars color can be changed.
      Type is System.Drawing.Color. Default is BarColor = Color.Black.
      Web Stream URL Parameter: BarColor.
  • 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 Rotate property, if you want to rotate barcode image. Valid values are as below.
    • 0 (RotateOrientation.BottomFacingDown)
    • 1 (RotateOrientation.BottomFacingLeft)
    • 2 (RotateOrientation.BottomFacingUp)
    • 3 (RotateOrientation.BottomFacingRight)
    • Default Value is 0 (RotateOrientation.BottomFacingDown)
      Web Stream URL Parameter: Rotate. Valid values are: 0, 1, 2, 3
  • 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".


3. All Barcode Types











   Copyright BarcodeLib.com. All rights reserved.