KA.Barcode for .NET Suite
How to Generate PDF-417 in C# Application
How to Generate 2D PDF-417 Barcode Images Using Visual C# in .NET Applications

C# PDF 417 Barcode Generator Library
How to generate, create PDF417 2d barcode with free c# example source code









  • Completely written in C#.NET with full integration into .NET development environments
  • Generate PDF-417 barcode in ASP.NET, WinForms, Class & Console, Crystal Reports & RDLC Reports
  • Generate PDF-417 images in stream & graphics object and support png, jpeg, gif, tiff & bmp image formats
  • Offer flexible PDF-417 barcode dimension options to select, like width, height, color, orientation, resolution, etc
  • Support PDF-417 Column Count, PDF-417 Row Count, PDF-417 Truncation and Error Correction Level properties
  • Create PDF-417 barcode images with C# sample code compatible with latest PDF-417 encoding specifications
C# PDF-417 Barcode Control Summary
KA.Barcode for .NET Suite is a mature and reliable barcoding encoder control SDK for generating two-dimensional Data Matrix images in .NET development environment. Developers can easily create and display Data Matrix in ASP.NET web pages, Windows Forms & Crystal Reports with C# programming. Flexible barcode settings are also available for users to customize generated images.
KeepAutomation barcode encoder for .NET is a versatile barcoding component SDK API for developers to easily generate & integrate PDF-417 and other linear & 2D barcode symbologies in .NET projects with C# progamming. What's more, a variety of barcoding features are available for users to adjust the generated barcode images, such as row count, column count, width, height, orientation, etc.
What Is A PDF-417 Barcode
PDF-417, also named Portable Data File 417, PDF 417, PDF417 Truncated, is a stacked bi-dimensional barcode symbol used mainly in transport, inventory management and identification cards.

Create PDF-417 using C# in ASP.NET web apps

This barcode encoder control SDK library provides three methods to stream PDF-417 in ASP.NET: barcode control drag-and-drop in ASP.NET websites, Visual C# Class Library and Microsoft IIS. Installation is quite simple as you only need to add this library to reference or Toolbox. For detailed guide, click here:
Generate barcodes using C# in ASP.NET Core web app
Generate barcodes using C# in ASP.NET Core MVC web application
How to print barcode in Visual C# with ASP.NET web control.

Create PDF-417 using C# in .NET Windows (Desktop) applications

To paint and draw PDf-417 barcode images in .NET Windows Forms applications, you can add control to Toolbox and drag & drop it for direct PDF-417 image generation. Or you can add the barcode library to reference and generate PDF-417 with Visual C# Class Library / Console Application. Here is a detailed guide:
How to create barcode in .NET WinForms with Visual C#
Generate barcodes using C# in WPF .NET Core Windows applications


PDF-417 Valid Data Sets
  • All 128 characters of ASCII

  • Extended ASCII. Values 128-255 in accordance with ISO 8859-1.




Encode Non-printable Chars in PDF-417
  • Set TildeEnabled to true

  • Use '~ddd' for non-printable chars. For example, ASCII char [GS] is non-printable, and its decimal value is 29. In barcode data, you need use ~029 for char [GS].




Encode byte[] in PDF-417 Barcode
The following C# source codes demo how to encode byte[] object in PDF-417
//  Byte array to encode
byte[] dataBytes = new byte[] { 0x41, 0x42, 0x43, 0x44, 0x45 };

//  Convert byte array to the input (property CodeToEncode)
String inputMsg = "";
foreach (byte b in dataBytes)
    inputMsg += "~" + b.ToString().PadLeft(3, '0');

//  Create barcode
BarCode barcode = new BarCode();
barcode.Symbology = Symbology.PDF417;
barcode.PDF417DataMode = PDF417DataMode.Byte;
//  enable '~' in the input message
barcode.TildeEnabled = true;
barcode.CodeToEncode = inputMsg;

//  set module size
barcode.BarcodeUnit = BarcodeUnit.Pixel;
barcode.X = 3;
barcode.PDF417XtoYRatio = 0.6F;
barcode.PDF417ColumnCount = 5;
barcode.PDF417RowCount = 10;

barcode.generateBarcodeToBitmap().Save(@"C:\PDF417_Bytes.png");




Encode non-English text in PDF-417 Barcode
The following C# source codes demo how to encode non English text (such as Japanese text) in PDF-417
//  Message in Japanese
String unicodeMsg = @"おはようございます";

//  Convert Unicode string to data bytes
byte[] dataBytes = Encoding.Unicode.GetBytes(unicodeMsg);
//  Convert byte array to the input (property CodeToEncode)
String inputMsg = "";
foreach (byte b in dataBytes)
    inputMsg += "~" + b.ToString().PadLeft(3, '0');

//  Create barcode
BarCode barcode = new BarCode();
barcode.Symbology = Symbology.PDF417;
barcode.PDF417DataMode = PDF417DataMode.Byte;
//  enable '~' in the input message
barcode.TildeEnabled = true;
barcode.CodeToEncode = inputMsg;

//  set module size
barcode.BarcodeUnit = BarcodeUnit.Pixel;
barcode.X = 3;
barcode.PDF417XtoYRatio = 0.6F;
barcode.PDF417ColumnCount = 5;
barcode.PDF417RowCount = 10;

barcode.generateBarcodeToBitmap().Save(@"C:\PDF417_Japanese.png");




Generate Barcode Image in Specified Width and Height
  • Set property AutoSizeAdjust to true

  • Set property DPI to be the same or higher as your printer's resolution

  • Set property BarcodeUnit to inch or cm

  • Set property BarCodeWidth and BarCodeHeight to your required image width and height
PDF-417 Property Settings
PDF-417 Barcode Generation in .NET Applications with C#