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


  • 3 minutes to read

PDF417 (Portable Data File) is a stacked linear two-dimensional barcode. It is used in different fields, including transport, postal, identification card, and inventory management.

barcode - PDF417

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

Add the Bar Code to a Report

  1. Drag the XRBarCode item from the DX.20.2: Report Controls tab and drop it onto the report.

  2. Set the XRBarCode control’s Symbology property to PDF417 (an object of the PDF417Generator type).

  3. Specify common barcode properties and properties specific to PDF417.

Specific Properties

  • XRBarCode.AutoModule/BarCodeControl.AutoModule

    Gets or sets whether the Module property value should be calculated automatically based upon the barcode’s size.

  • Columns

    Gets or sets the number of bar code columns, which allows control of the logic width of the bar code.

  • CompactionMode

    Gets or sets whether text or binary mode should be used to encode the barcode’s data.

  • ErrorCorrectionLevel

    Gets or sets the amount of redundancy built into the bar code’s coding, to compensate for calculation errors.

  • Rows

    Gets or sets the number of bar code rows, which allows control of the logic height of the bar code.

  • TruncateSymbol

    Gets or sets whether the special end-symbol should be appended to the bar code.

  • YToXRatio

    Gets or sets the height-to-width ratio of a logical unit’s graphic representation.

Runtime Example

The following code creates the PDF417 barcode and specifies its properties.


The complete sample project is available in the following repository:

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 BeforePrint event.

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

private void XtraReport1_BeforePrint(object sender, PrintEventArgs e) {