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.
For more information on this symbology, refer to its Official Standard.
Add the Bar Code to a Report
Drag the XRBarCode item from the DX.24.1: Report Controls tab and drop it onto the report.
Set the XRBarCode control’s Symbology property to PDF417 (an object of the PDF417Generator type).
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.
-
Gets or sets the number of bar code columns, which allows control of the logic width of the bar code.
-
Gets or sets whether text or binary mode should be used to encode the barcode’s data.
-
Gets or sets the amount of redundancy built into the bar code’s coding, to compensate for calculation errors.
-
Gets or sets the number of bar code rows, which allows control of the logic height of the bar code.
-
Gets or sets whether the special end-symbol should be appended to the bar code.
-
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.
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: