KA.Barcode Generator for .NET Suite
How to Generate PDF-417 Image in C# Projects
Complete C# source code to generate PDF-417 images in different image formats using Barcode for .NET

Generate PDF417 barcode code with free C# open source example

  • Support PDF417 generation in .NET development environments like Microsoft Visual Studio 2005, 2010, etc
  • Other barcode solutions provided - barcode Excel, .NET WinForms barcode, Word barcode, etc.
  • Compatible with .NET Framework 2.0, 3.0, 3.5 and above versions
  • Create and draw matrix PDF417 images in Windows forms, insert images in ASP.NET websites and Crystal Reports
  • Easily make and save PDF 417 bar codes in various image formats like Png, Jpg, Gif, Tiff, Bmp, etc
  • Friendly-interface to customize PDF 417 image column and row number in C#.NET programming
  • Support to print 2D barcode in ASP.NET as well, including .NET WinForms EAN 128, Java QR Code, PDF417 C#
  • Support PDF 417 Truncated Version for maximum data density and space efficiency
  • Compatible with ISO/IEC 15438 specification for matrix PDF 417 with valid image output for all scanners
  • Resolution, orientation adjustable to print, produce high-quality PDF 417 barcodes for all printers
PDF-417 is also named as Portable Data File 417, PDF 417, PDF417 Truncated, Compact PDF417. KA.Barcode Generator for .NET Suite is a reliable barcode generating component SDK, which makes it simple to generate, print high-quality Png, Jpeg, Gif PDF417 barcode images in Visual C#.NET class, ASP.NET web projects, Windows applications, etc. Besides this image setting tutorial, KeepAutomation also provides C# examples on data encoding and size setting.
How to Generate, Specify PDF-417 Barcode Images in C# Class

Installation of KA.Barcode Generator for .NET Suite

  1. 1.
  2. 2.
    Add Reference: Add "KeepAutomation.Barcode.Window.dll" to your C#.NET project reference.
Copy the following C#.NET barcoding program onto your project to create, make a PDF-417 barcode picture.
using KeepAutomation.Barcode.Bean;

BarCode pdf417= new BarCode();
pdf417.Symbology = KeepAutomation.Barcode.Symbology.PDF417;
pdf417.CodeToEncode = "Pdf417";
pdf417.X = 3;

PDF417 X to Y Ratio

The X dimension is the width of the narrowest bar in a generated PDF 417 barcode image. The Y dimension is the height of each row in a PDF417 barcode symbol, i.e. the module bar height. The parameter of XtoYRatio is valid from 0.2 to 0.5 inclusive, with 0.3 being the most common value. Default value is 0.3333 for KA.Barcode Generator for .NET Suite PDF417 XtoYRatio.
pdf417.PDF417XtoYRatio = 0.3;

PDF417 Barcode Margins

Margins are called quiet zones in the barcode specification. The ISO/IEC 15438 specification for PDF417 requires margins on four sides of a PDF417 image with twice the value of X dimension. For example, if you set X to 3 pixels, then you copy the demo code below:
pdf417.LeftMargin = 6;
pdf417.RightMargin = 6;
pdf417.TopMargin = 6;
pdf417.BottomMargin = 6;

PDF417 Image Formats

KA.Barcode Generator for .NET Suite supports printing and saving PDF417 barcodes in different image formats, including Png, Jpeg/Jpg, Gif, Tiff, Bmp, etc. Follow the demo code below to save PDF 417 in Png image format.
pdf417.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

PDF417 Barcode Unit

KA.Barcode Generator for .NET Suite provides three units of measure for PDF417 image generation: Pixel, Cm and Inch.
The default value is Pixel. Copy the demo code below to set PDF417 unit of measure to pixel.
pdf417.BarcodeUnit = BarcodeUnit.Pixel;

PDF417 Image Resolution

KA.Barcode Generator for .NET Suite is designed to help you print high-quality barcode images in C#.NET. You can customize image resolution through DPI, which is short for Dots per Inch. 72 DPI is the default value for the generated PDF417 images.
pdf417.DPI = 72; 

PDF417 Image Orientation

In case you want to rotate generated PDF417 barcode images to change its position, i.e. the barcode rotation angle, KA.Barcode Generator for .NET Suite provides four types of barcode orientations for you to choose from: 0 degree, 90 degrees, 180 degrees, and 270 degrees.
pdf417.Orientation = KeepAutomation.Barcode.Orientation .Degree90

PDF417 Row Count / PDF417 Column Count

KeepAutomation Barcode Generator for .NET Suite allows you to adjust PDF417 row number and column number as well. As specified in PDF417 standard, each PDF417 symbol consists of a stack of vertically aligned rows (3 to 90 rows). Each row shall include a minimum of 1 symbol character (1 to 30 columns).
pdf417.PDF417ColumnCount = 3;
pdf417.PDF417RowCount = 5;

PDF417 Truncated / Compact PDF417

According to the latest ISO/IEC 15438 PDF417 bar code symbology specification, it is possible to reduce some of the row overhead to improve the PDF417 symbol density when used in relatively clean environments. The Compact PDF417 is the preferred term compared with the former one PDF417 Truncated. To be more space-efficient, simply enable this function by copying the following C# demo code.
pdf417.PDF417Truncated = true;