Skip to main content

PDF417

  • 2 minutes to read

PDF417 (Portable Data File) is a stacked, two-dimensional barcode used for transport, postal, identification, and inventory workflows. The symbol typically includes 3 to 90 rows of linear codewords.

View Example

Examples

Configure Barcode Settings (PDF417Options)

Use the PDF417Options class to configure PDF417 barcode settings.

The following code snippet creates the PDF417 barcode and specifies its settings:

DevExpress Barcode Generator - PDF417 barcode

using DevExpress.Docs.Barcode;
using DevExpress.Drawing;
using System.Drawing;

var pdf417Options = new PDF417Options();
pdf417Options.Columns = 3;
pdf417Options.TruncateSymbol = false;
pdf417Options.ErrorCorrectionLevel = PDF417ErrorCorrectionLevel.Level2;
pdf417Options.BackColor = Color.LightGray;
pdf417Options.ShowText = false;
pdf417Options.Padding = new Padding(5);
pdf417Options.BorderWidth = 1;
pdf417Options.BorderColor = Color.Blue;

using var pdf417OptionsStream = new FileStream(Path.Combine(outDir, "barcode_symbology_pdf417.png"), FileMode.Create, FileAccess.Write);
using var pdf417OptionsGenerator = new BarcodeGenerator(pdf417Options);
pdf417OptionsGenerator.Export("PDF417 DEMO 1234567890", pdf417OptionsStream, DXImageFormat.Png);

Configure Barcode Settings (Fluent API)

Use the PDF417OptionsBuilder class to configure PDF417 barcode settings with Fluent API.

The following code snippet creates the PDF417 barcode and specifies its settings:

DevExpress Barcode Generator - PDF417 barcode

using DevExpress.Docs.Barcode;
using DevExpress.Drawing;
using System.Drawing;

var pdf417Code = PDF417OptionsBuilder.Create()
    .WithColumns(3)
    .WithTruncateSymbol(false)
    .WithErrorCorrectionLevel(PDF417ErrorCorrectionLevel.Level2)
    .WithBackColor(Color.LightGray)
    .WithShowText(false)
    .WithPadding(5)
    .WithBorderWidth(1)
    .WithBorderColor(Color.Blue)
    .Build();

var filePath = Path.GetFullPath("pdf417_barcode.png");

using var stream = new FileStream(filePath, FileMode.Create);
using var generator = new BarcodeGenerator(pdf417Code);
generator.Export("PDF417 DEMO 1234567890", stream, DXImageFormat.Png);

Symbology-Specific Options

Property Description
CompactionMode Specifies the compaction mode.
ErrorCorrectionLevel Specifies the error correction level.
Rows Specifies the number of rows in a PDF417 barcode.
Columns Specifies number of columns in the symbol’s data region.
TruncateSymbol Specifies whether the right-hand side of the code symbol is truncated to create a compact code.
YToXRatio Specifies the Y (the height of each row) to X (width of the narrowest bar) ratio of the symbol.
See Also