Home > .NET Barcode > C# Barcode Generation Guide > C#.NET PDF-417 Generator SDK Tutorial, also creates 2D barcodes: QR Code, Data Matrix

PDF-417 Barcode Library DLL for .NET in C# Class

How to Generate 2D Barcode Images in .NET with C# Programming


  • Completely built in managed C# .NET code, compatible with .NET Framework 2.0 and greater
  • Professional & mature PDF-417 C#.NET barcode generator library in use for more than 10 years
  • Generate & print PDF-417 barcodes images in C#.NET Class & console application
  • Create & draw PDF-417 barcodes in C# ASP.NET Website / webpage / webform & C# WinForms Project
  • Generate PDF-417 barcodes in Reporting Services & Crystal Reports & RDLC Reports
  • One-time purchase for royalty-free developer license for C#.NET barcode Library

C#.NET 2D PDF-417 Barcode Introduction

PDF417 is a 2D, high-density barcode. It is the combination of several rows and columns. PDF-417 is able to encode numbers, data byte and texts. As it can store data securely and inexpensively, PDF-417 has been widely used today.




Quick to Create, Print PDF417 Barcode using C#

Using BarcodeLib C# Barcode library, you can quickly create ISO standard PDF417 in C# application.
  • Create a PDF417 object
  • Enter PDF417 encoding text to property Data
  • Use method drawBarcode() to print PDF417 to an image file
PDF417 barcode = new PDF417();
barcode.Data = "PDF417";
barcode.drawBarcode("C://BarcodeLib//csharp-pdf417-sample-image.png");





Encoding PDF417 text in C#



Encode ASCII characters

PDF-417 barcode supports all 128 ASCII characters encoding. Full ASCII table includes 128 characters. 95 of them are printable characters, and 33 of them are control characters, which do not have graphical label, and they are non-printing characters.

It is easy to create PDF-417 barcode with printable ASCII chars. You directly enter the ASCII chars in property Data.

PDF417 barcode = new PDF417();
barcode.Data = "ABC-123-abc-*%$#";
barcode.drawBarcode("C://BarcodeLib//csharp-pdf417-ascii-chars.png");





To print PDF-417 with non-printing chars, you cannot directly pass the characters to Data property.
  • Set ProcessTilde to true.
  • Pass the property Data with the ASCII value of the non-printing char in three digits behide the char tilde '~'.
PDF417 barcode = new PDF417();
barcode.ProcessTilde = true;
barcode.Data = "ABC-1~0132-abc";
barcode.drawBarcode("C://BarcodeLib//csharp-pdf417-ascii-control-chars.png");



Encode Unicode Text

  • Set IsUnicodeData to true. The barcode library will automatically create PDF417 barcode with Unicode text encoded from property Data
PDF417 barcode = new PDF417();
barcode.Data = "你好"; // hello in Chinese
barcode.IsUnicodeData = true;
barcode.drawBarcode("C://BarcodeLib//csharp-pdf417-unicode-text.png");





Print PDF417 with specified size using C#

  • Set the property BarWidth with PDF417 bar module width
  • Set the property BarRatio with PDF417 bar module width vs height ratio
  • Set the property Columns, and Rows with the PDF417 number of columns and rows.
PDF417 barcode = new PDF417();
barcode.Data = "PDF417";
barcode.BarWidth = 5;  
barcode.BarRatio = 0.3333f;
barcode.Columns = 5;    
barcode.Rows = 12;      
barcode.drawBarcode("C://BarcodeLib//csharp-pdf417-size.png");





Create PDF417 with advanced options using C#



Error Correction Level (ECL)

  • Set the property ECL with PDF417 error correction level
PDF417 barcode = new PDF417();
barcode.Data = "PDF417";
barcode.ECL = PDF417ErrorCorrectionLevel.Level_6;
barcode.drawBarcode("C://BarcodeLib//csharp-pdf417-ecl.png");



Compact PDF417

Compact PDF417 is also named as Truncated PDF417. In the original AIM USA (1994) and AIM Europe (1994) PDF417 specifications, the term Truncated PDF417 has been used in a technically synonymous manner.

To create compact PDF417 using C# PDF417 Generator library, you need set property Compact to true;

PDF417 barcode = new PDF417();
barcode.Data = "PDF417";
barcode.Compact = true;
barcode.drawBarcode("C://BarcodeLib//csharp-pdf417-compact.png");



Macro PDF417

Macro PDF417 provides a mechanism for the data in a file to be split into blocks and be represented in multiple PDF417 symbols. This mechanism is similar to the Structured Append feature in QR Code and Data Matrix.

Up to 99 999 individual PDF417 symbols may be used to encode data in Macro PDF417.

PDF417 barcode = new PDF417();
barcode.Data = "PDF417";
barcode.MacroPDF417 = true;
//  Valid range: 0 ~ 99998
barcode.MSegmentIndex = 0;
//  Each int must be in range [0, 899]
barcode.MFileID = new int[] { 100, 200 };

//  To encode all optional fields
barcode.MContainOptional = true;
//barcode.MOptFileName = "File Name";
//  Valid: 1 ~ 99999
barcode.MOptSegmentCount = 3;
//barcode.MOptTimeStamp = 1;
//barcode.MOptSender = "Sender";
//barcode.MOptAddressee = "Addressee";
//barcode.MOptFileSize = 100;
//  Max. value: 0xFFFF
//barcode.MOptChecksum = 0x1234;
barcode.drawBarcode("C://BarcodeLib//csharp-pdf417-macro.png");





How to Create PDF-417 Barcodes in C# ASP.NET?

With this C# QR Code generator, you can stream QR Code barcode images in ASP.NET using C#.NET in two ways.
  1. Add Barcodelib.Barcode.ASP.NET.dll to your web project.
  2. Or add Barcodelib.Barcode.ASP.NET.dll to the Toolbox.
  3. Find the folder barcode in the trial package and copy files "pdf417.aspx", "pdf417.aspx.cs" to your web project folder.
  4. Drag PDF417ASPNET from the Toolbox and drop it on your web project. Then you will see a PDF417 barcode image.
  5. Adjust barcode parameters in the Properties Window or generate it with above free C# source code.
  6. Run the project and you will see the generated PDF 417 barcode on your aspx pages.




How to Generate PDF417 in C# WinForms?

  1. Add BarcodeLib.Barcode.WinForms.dll to your Windows Forms project.
  2. Or Add BarcodeLib.Barcode.WinForms.dll to the Toolbox.
  3. Drag PDF417WinForm to your windows form and you will see a PDF417 barcode image. Click the image and adjust its settings in the Properties Window or create a PDF417 barcode with above free C# sample code.
Barcode Images Supported by C# PDF-417 Generator SDK
C# 1D Barcode Generation:
C# 2D Barcode Generation:
Supported Visual C# Linear Barcode Images: Codabar, Code 11, Code 2 of 5, Code 39, Code 93, EAN-8, EAN-13, Interleaved 2 of 5, ITF-14 (UPC Shipping Container Symbol), Code 128, EAN 128/GS1 128, MSI Plessey, Intelligent Mail, Planet, Postnet, RM4SCC (British Royal Mail), UPC-A, UPC-E.
Supported Visual C# 2D Barcode Images: Data Matrix, PDF 417, QR Code.