Skip to main content

PDF417

  • 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.23.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 on the barcode 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.

View Example: How to add a bar code to a report

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 barcode control.
    XRBarCode barCode = new XRBarCode();

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

    // Adjust the barcode'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 barcode 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;
}

The code example below shows how to create a report with the PDF417 barcode:

using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
//...

var barCode = CreatePDF417BarCode("012345678");

var report = new XtraReport() {
    Bands = {
        new DetailBand() {
            Controls = { barCode }
        }
    }
};