Skip to main content
A newer version of this page is available. .

PDF417

  • 3 minutes to read

Short Description

PDF417 (Portable Data File) is a stacked linear two-dimensional bar code used in a variety of applications; primarily transport, postal, identification card and inventory management. It was invented by Ynjiun Wang at Symbol Technologies in 1991, and has spawned an Open Source decoder project together with an Open Source encoder.

The PDF417 bar code is also called a symbol bar code and usually consists of 3 to 90 rows, each of which is like a small linear bar code.

barcode - PDF417

For more information on this symbology, refer to its Official Standard web page.

Bar Code Properties

The type of a bar code control’s Symbology property is PDF417Generator.

The following properties are specific to the PDF417 type.

Examples

The following code creates a PDF417 bar code and specifies its main properties.

using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreatePDF417BarCode(string BarCodeText) {
    // Create a bar code control.
    XRBarCode barCode = new XRBarCode();

    // Set the bar code's type to PDF417.
    barCode.Symbology = new PDF417Generator();

    // Adjust the bar code's main properties.
    barCode.Text = BarCodeText;
    barCode.Width = 400;
    barCode.Height = 150;

    // If the AutoModule property is set to false, uncomment the next line.
    barCode.AutoModule = true;
    //barcode.Module = 3;

    // Adjust the properties specific to the bar code type.
    ((PDF417Generator)barCode.Symbology).Columns = 1;
    ((PDF417Generator)barCode.Symbology).CompactionMode = PDF417CompactionMode.Text;
    ((PDF417Generator)barCode.Symbology).ErrorCorrectionLevel = ErrorCorrectionLevel.Level2;
    ((PDF417Generator)barCode.Symbology).Rows = 9;
    ((PDF417Generator)barCode.Symbology).TruncateSymbol = false;
    ((PDF417Generator)barCode.Symbology).YToXRatio = 3;

    return barCode;
}

To add the XRBarCode to a report band, handle the report’s XRControl.BeforePrint event.

using System.Drawing.Printing;
// ...

private void XtraReport1_BeforePrint(object sender, PrintEventArgs e) {
    this.Detail.Controls.Add(CreatePDF417BarCode("012345678"));
}