Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Barcode > Barcode Generation Guide > .NET PDF 417 Generator for .NET, ASP.NET, C#, VB.NET
Download Barcode for .NET Suite Trial

.NET PDF-417 Generator for .NET, ASP.NET, C#, VB.NET

PDF-417 Bar Code Generation Guide in .NET, C#, ASP.NET, VB.NET
  • Easily generate PDF-417 barcodes in .NET applications
  • Compatible with the latest PDF-417 ISO specification [ISO/IEC 15438 (Second edition 2006-06-01)]
  • Generate high quality PDF-417 images in JPEG, GIF & PNG formats
  • 100% build in C#, compatible with .net 2.0 and later version
  • Generate PDF-417 barcodes using C#, VB.NET on ASP.NET or Windows Forms
  • Generate PDF-417 in Crystal Reports using C#, VB.NET
  • Generate PDF-417 in Reporting Service using C#, VB.NET
  • Mature .NET Barcode Generator component since 2003
  • Royalty-free and perpetual developer license
.NET PDF-417 Introduction
PDF-417 is also known as Portable Data File 417, PDF 417, PDF417 Truncated.
Compatibility: Barcode for .NET component is compatible with ISO/IEC 15438 (Second edition 2006-06-01).
PDF417, or Portable Data File 417, is a two-dimensional stacked barcode symbology capable of encoding over a kilobyte of data per label. It was developed by Symbol Technologies (1989-1992) and is currently maintained by ANSI / AIM USA.
Large amounts of text and data can be stored securely and inexpensively when using the PDF417 symbology. The printed symbol consists of several linear rows of stacked codewords. Each codeword represents 1 of 929 possible values from one of three different clusters. A different cluster is chosen for each row, repeating after every three rows.
.NET PDF-417 Basic Characteristics
PDF417 is a bar code symbology with the following basic characteristics:
  1. Encodable character set:
    • Text Compaction mode permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters.
    • Byte Compaction mode permits all 256 possible 8-bit byte values to be encoded. This includes all ASCII characters value 0 to 127 inclusive and provides for international character set support.
    • Numeric Compaction mode permits efficient encoding of numeric data strings.
    • Up to 811 800 different character sets or data interpretations.
    • Various function codewords for control purposes.
  2. Symbol character structure: (n, k, m) characters of 17 modules (n), 4 bar and 4 space elements (k), with the largest element 6 modules wide (m).
  3. Maximum possible number of data characters per symbol (at error correction level 0): 925 data codewords which can encode:
    • Text Compaction mode: 1 850 characters (at 2 data characters per codeword).
    • Byte Compaction mode: 1 108 characters (at 1,2 data characters per codeword).
    • Numeric Compaction mode: 2 710 characters (at 2,93 data characters per codeword).

      At the minimum recommended error correction level, there is a maximum of 863 data codewords which
      can encode:
    • Text Compaction mode: 1 726 characters (at 2 data characters per codeword).
    • Byte Compaction mode: 1 033 characters (at 1,2 data characters per codeword).
    • Numeric Compaction mode: 2 528 characters (at 2,93 data characters per codeword).
  4. Symbol size:
    • Number of rows: 3 to 90.
    • Number of columns: 1 to 30.
    • Width in modules: 90X to 583X including quiet zones.
    • Maximum codeword capacity: 928 codewords.
    • Maximum data codeword capacity: 925 codewords.
      Since the number of rows and the number of columns are selectable, the aspect ratio of a PDF417 symbol
      may be varied when printing to suit the spatial requirements of the application.
  5. Selectable error correction: 2 to 512 codewords per symbol.
  6. Non-data overhead:
    • Per row: 73 modules, including quiet zones.
    • Per symbol: a minimum of 3 codewords, represented as symbol characters.
  7. Code type: continuous, multi-row two-dimensional.
  8. Character self-checking: Yes.
  9. Bi-directionally decodable: Yes.
.NET PDF-417 Encoding Data Scope
PDF417 Barcode for .NET, ASP.NET supports:
  • All 128 characters of ASCII
How to Generate PDF 417 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/pdf417.aspx?Data=123456789&ModuleSize=3&LeftMargin=6&RightMargin=6&TopMargin=6&BottomMargin=6
  • 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/pdf417.aspx?Data=123456789&ModuleSize=3&LeftMargin=6&RightMargin=6&TopMargin=6&BottomMargin=6" />
    Using this method, it will not generate any barcode images in your IIS server side.
How to Generate PDF 417 Barcode Image through ASP.NET Web Form Control?
  1. Install .NET Barcode Controller to your ASP.NET project.
    • Add Reference BarcodeLib.Barcode.ASP.NET.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.
    • Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
    • Right click Toolbox, click menu Choose Items...
    • Goto .NET Framework Components tab.
    • If no BarcodeLib component found, click Browse... button and select BarcodeLib.Barcode.ASP.NET.dll file.
    • Then sort "Namespace" column, you will find 4 components from BarcodeLib.Barcode.
    • Check component LinearASPNET, and its namespace is BarcodeLib.Barcode.
    • Click "OK" button, you will find four components under "General": LinearASPNET.
  3. Go to "barcode" folder in the trial package, copy file "linear.aspx" to the same folder as your aspx page, which will generate barcodes.
  4. You can drag LinearASPNET 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.
How to Generate PDF 417 Barcode Image through .NET Windows Form Control in C# or VB.NET?
  1. Add Reference BarcodeLib.Barcode.WinFroms.dll to your project. Do not copy the dll to the bin directory, Visual Studio will do so, during project compilation time.
    • In your .NET windows project, right click mouse over Refereces in your Solution Explorer window. Then click menu "Add Reference ...".
    • Add BarcodeLib.Barcode.WinFroms.dll to your project.
  2. Add barcode library to your Visual Studio Toolbox.
    • Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
    • Right click Toolbox, click menu Choose Items...
    • Goto .NET Framework Components tab.
    • If no BarcodeLib component found, click Browse... button and select BarcodeLib.Barcode.WinFroms.dll file.
    • Then sort "Namespace" column, you will find 4 components from BarcodeLib.Barcode.
    • Check component LinearWinForm, and its namespace is BarcodeLib.Barcode.
    • Click "OK" button, you will find the control under "Common Controls": LinearWinForm.
  3. Now you can see the component displayed on Toolbox. You can drag LinearWinForm on your form, change barcode setting through properties widnow.
How to Generate PDF 417 Barcode Image in .NET, C#, VB.NET class?
Add Reference BarcodeLib.Barcode.ASP.NET.dll or BarcodeLib.Barcode.WinFroms.dll to your .NET project (ASP.NET website, Forms, any .NET project).
In your .NET 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);
Above code written in C# 2005
How to Save PDF 417 Barcode Images using .NET Barcode Generator Windows Control?
In Windows Controller, just call method SaveAsImage(string filename). e.g. SaveAsImage("C:\barcode.gif");
.NET PDF-417 Property Settings
  1. Set the Data property with the value to encode. Type is string.
    Web Stream URL Parameter: Data.
  2. Set the Encoding property. Default is PDF417Encoding.Auto that supports all the following encoding modes.
    Web Stream URL Parameter: Encoding. Valid values: 0(Auto), 1(Text), 2(Binary), 3(Numeric).
    • 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.
  3. 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.
  4. 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".
  5. 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".
  6. 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: ResizeImage.
    • Set the Resolution property (Value is expressed in DPI - Dots per inch).
      Type is int. Default is 96 dpi.
      Web Stream URL Parameter: Resolution.
  7. 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 ModuleColor property. Barcode bars color can be changed.
      Type is System.Drawing.Color. Default is ModuleColor = Color.Black.
      Web Stream URL Parameter: ModuleColor.
  8. 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.
  9. Set Rotate property, if you want to rotate barcode image.
    Valid values are as below. Default Value is 0 (RotateOrientation.BottomFacingDown).
    Web Stream URL Parameter: Rotate. Valid values are: 0, 1, 2, 3
    • 0 (RotateOrientation.BottomFacingDown)
    • 1 (RotateOrientation.BottomFacingLeft)
    • 2 (RotateOrientation.BottomFacingUp)
    • 3 (RotateOrientation.BottomFacingRight)
All Supported .NET Barcode Symbologies
Generate Linear Barcodes:
Generate 2D Barcodes:





Provides High Quality .NET Barcode, Barcode .NET WinForms, C# Barcode, ASP.NET Barcode, VB.NET Barcode, .NET PDF-417 Lib, ASP.NET PDF-417 Lib, C# PDF-417 Lib, VB.NET PDF-417 Lib, .NET WinForms PDF-417 Lib, .NET SSRS PDF-417, .NET Crystal Reports PDF-417, .NET RDLC Reports PDF-417.