PDF-417, stacked linear barcode symbol format, is a 2D symbology barcode which can store up to about 1,800 printable ASCII characters or 1,100 binary characters per symbol. Large amounts of text and data can be stored securely and inexpensively when using the PDF417 barcode symbology. This 2D barcode is used in a variety of applications, primarily transport, identification cards, and inventory management.

.NET PDF417 creator allows developers to generate and encode PDF-417 barcode in PDF page easily and fast. In this guide, we will show you how to make PDF 417, and insert the barcode graphics to PDF document in Console application using C#.NET language.


// Create a new PDF document.
PdfDocument document = new PdfDocument();

// Create a page.
PdfPage page = document.AddPage();

// Get graphics object from pdf page
XGraphics g = XGraphics.FromPdfPage(page);

// Create a pdf barcode object
PdfBarcode barcode = new PdfBarcode();

// Set the barcode type to pdf417 symbol
barcode.BarType = BarCodeType.PDF417;

// Set barcode date to encode
barcode.Data = "xspdf123456789";

// Change foreground and background color of barcode
barcode.BarcodeColor = XColors.Black;
barcode.BackgroundColor = XColors.White;

// Set pdf417 compact/truncated
barcode.PDF417Compact = false;
                       
// Set the barcode Position and location
barcode.Location = new XPoint(100, 100);

// Set the barcode width and height
barcode.Size = new XSize(200, 50);

barcode.DrawBarcode(g);

// Save and show the document           
document.Save("Barcode.pdf");
Process.Start("Barcode.pdf");

More PDF tutorial