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


.NET Barcode Developer Guide > .NET Barcode PDF-417 Developer Guide

.NET PDF-417 Barcode Property Settings



1. Generate PDF-417 in .NET Class

The following C#.net code illustrates how to generate a PDF-417 barcode in a C# class

	BarcodeLib.Barcode.PDF417 barcode = new BarcodeLib.Barcode.PDF417();

	barcode.Data = "417";

	barcode.UOM = UnitOfMeasure.PIXEL;
	barcode.BarWidth = 2;
	barcode.BarRatio = 0.3333333f;
	barcode.LeftMargin = 0;
	barcode.RightMargin = 0;
	barcode.TopMargin = 0;
	barcode.BottomMargin = 0;

	barcode.Rows = 7;
	barcode.Columns = 5;

	barcode.Encoding = BarcodeLib.Barcode.PDF417Encoding.Text;

	barcode.ECL = BarcodeLib.Barcode.PDF417ErrorCorrectionLevel.Level_2;

	barcode.Compact = false;

	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. PDF-417 Barcode Property Settings
  • Set the Data property with the value to encode. Type is string.
    Web Stream URL Parameter: Data.
  • Set the Encoding property. Default is PDF417Encoding.Text.
    • PDF417Encoding.Binary: It allows encoding all 256 possible 8-bit byte values. This includes all ASCII characters value from 0 to 127 inclusive and provides for international character set support.
    • PDF417Encoding.Text: It allows encoding all printable ASCII characters, i.e. values from 32 to 126 inclusive in accordance with ISO/IEC 646, as well as selected control characters such as TAB (horizontal tab ASCII 9), LF (NL line feed, new line ASCII 10) and CR (carriage return ASCII 13).
    • PDF417Encoding.Numeric: It allows encoding numeric data.
    Web Stream URL Parameter: Encoding. Valid values: "binary", "numeric", "text".
  • Set the ECL property. PDF417 Error Correction Level. Default is PDF417ErrorCorrectionLevel.Level_2 (2).
    Web Stream URL Parameter: ECL. Valid values: (int, 0~8)PDF417ErrorCorrectionLevel.
  • Set the Compact property. Compact PDF417 barcode is area efficient.
    Default is false.
    Compact PDF417 may be used where space considerations are a primary concern and symbol damage is unlikely.
    Web Stream URL Parameter: Compact. Valid values: "true" or "false".
  • Set the ProcessTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true.
    ~NNN: is used to represent the ASCII character with the value of NNN.
    Web Stream URL Parameter: ProcessTilde. Valid values are: "true", or "false".
  • 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 BarWidth (for bar cell width). Type is float, and default is 2.
      Web Stream URL Parameter: BarWidth.
    • Set the BarRatio properties. Type is float. Default is 0.3333333. Bar cell height = BarWidth * BarRatio.
      Web Stream URL Parameter: BarRatio.
    • Set the Rows properties. The number of data rows in the PDF-417 barcode.
      Type is int. Default is 4.
      Web Stream URL Parameter: Rows.
    • Set the Columns properties. The number of data columns in the PDF-417 barcode.
      Type is int. Default is 5.
      Web Stream URL Parameter: Columns.
    • 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


3. All Barcode Types







4. Barcode Generation Guide in Various .NET Developments







   Copyright BarcodeLib.com. All rights reserved.