Introduction of PDF-417 Crystal Reports Barcode Generator
PDF-417 barcode generator for Crystal Report is one function of our mature .NET barcode component, which is an easy-to-use .NET component with Xcopy deployment and creates PDF-417 in Crystal Report with C# or VB.NET sample code provided.
OnBarcode.com provides not only PDF-417
.NET Barcode SDK for Crystal Reports, but also other linear and 2D barcode generator for Crystal Report
with detailed online
how-to guide:
- .NET Crystal Reports Linear Barcodes: Code 39, Code 128, EAN-8, EAN-13, GS1 128, UPC-A, UPC-E, Interleaved 2 of 5, Identcode, ISBN, ISSN, ITF-14, Leitcode, MSI Plessey, Intelligent mail barcode, Planet, Postnet, RM4SCC, etc
- .NET Crystal Reports 2D Barcodes: including QR Code, Data Matrix, PDF-417
How to Generate PDF-417 in .NET Crystal Reports Barcode SDK
This page guide provides a detailed, step-by-step methodology for generating, printing PDF417 (a 2D stacked linear barcode symbology) in Crystal Reports for .NET within ASP.NET and Windows Forms (.net framework) projects.
It covers core implementation, PDF417 data encoding, dimension size configuration, error correction, and advanced features to ensure seamless integration with Crystal Reports components and adherence to ISO industry standards.
It covers core implementation, PDF417 data encoding, dimension size configuration, error correction, and advanced features to ensure seamless integration with Crystal Reports components and adherence to ISO industry standards.
Preparation
We includes two step by step tutorials on how to create new ASP.NET and Windows Forms .net framework projects to print barcodes in .rpt report file in .NET application.
After you have created a new ASP.NET or Windows Forms project with the first barcode printed in the .rpt report,
we will start to modify the tutoril to print PDF417 barcodes in the reports.
Print PDF417 in report designer and viewer
Follow these steps to generate PDF417 and embed it into a Crystal Report:
- Remove the existing
Linearobject generation C# code. - Instantiate a PDF417 barcode object (core class for PDF417 2D barcode generation).
- Assign the target data string to the Data property (map to a Crystal Reports Parameter field for dynamic data).
- Invork method
drawBarcodeAsBytes()to encode the Data Matrix barcode as a byte array and store it as a PNG image file in byte[] object (the standard format for Crystal Reports image controls in .rpt files). - Run the ASP.NET/WinForms project and load the Crystal Report via
CrystalReportViewer. Verify the PDF417 barcodes are displayed correctly in the report's Details section (or Report Header/Page Header).
PDF417 Barcode Data Characters Encoding in Crystal Reports for .NET (C#)
PDF417 Valid Character Set
PDF417 (supported in Crystal Reports for .NET) supports the following character sets:
- Full ASCII (128 characters defined in ISO/IEC 646).
- Extended ASCII (values 128–255 per ISO 8859-1, ideal for multilingual Crystal Reports data).
- Up to 811,800 distinct character sets/data interpretations (via ECI protocol).
- Various function codewords for control operations (compatible with Crystal Reports Filtering logic).
PDF417 Data Encoding Mode
PDF417 supports three compact encoding modes (optimized for different data types in Crystal Reports):
Use the
- Text Compaction mode: Encodes printable ASCII (32 - 126) and selected control characters (suited for Crystal Reports Summary field labels).
- Byte Compaction mode: Encodes all 8-bit byte values (0 - 255), enabling international character support (compatible with ADO.NET DataSet binding).
- Numeric Compaction mode: Efficiently encodes numeric data (ideal for Crystal Reports Group Header numeric identifiers).
Use the
DataMode property to set encoding mode (auto-selection recommended for dynamic Crystal Reports data):
PDF417 Maximum Data Length (Error Correction Level 0)
Data capacity varies by encoding mode (critical for Crystal Reports Grouping large datasets):
- Text Compaction mode: 1,850 characters.
- Byte Compaction mode: 1,108 characters.
- Numeric Compaction mode: 2,710 digits.
Note: Higher error correction levels reduce maximum data capacity. Adjust based on Crystal Reports report distribution requirements (e.g., physical printing may need higher ECL).
Encoding Text in PDF417 for Crystal Reports (C#)
Generate PDF417 with ASCII Text
PDF417 supports all 128 ASCII characters (95 printable, 33 non-printable). Printable ASCII requires no special handling.
You just enter the printing ASCII chars to property
Data.
Encode Non-Printable ASCII Characters
Non-printable characters (e.g., carriage return) require tilde processing for Crystal Reports integration:
- Replace non-printable chars with '~' + 3-digit ASCII value (e.g. carriage return =
~013). - Enable
ProcessTilde = trueto interpret the string tilde format.
PDF417 barcode = new PDF417(); barcode.ProcessTilde = true; barcode.Data = "PDF417~013abc";
Note: Ensure your barcode scanner processes tilde-encoded characters to restore original values (critical for Crystal Reports data accuracy).
Generate PDF417 with Unicode Text
Encode Unicode text (multilingual data) for Crystal Reports in ASP.NET/WinForms:
- Enable property
EncodeUnicodeTextto true to encode Unicode text string in PDF417 barcode.
PDF417 barcode = new PDF417(); barcode.EncodeUnicodeText = true; barcode.Data = "unicode text here";
Additional Supported Data Formats
PDF417 in Crystal Reports supports advanced data formats:
- Binary data: Encode raw binary files (e.g., serialized Crystal Reports Data Table data).
- GS1 System messages: Comply with GS1 Application Identifier standards (for supply chain reports).
- ECI mode: Encode extended character sets (e.g., Arabic, Cyrillic) for global Report distribution.
PDF417 Dimension Settings for Crystal Reports (C#)
You can quickly customize generated PDF417 image width and height using the following C# codes in report project.
You can also further customize PDF417 dimensions to fit Crystal Reports layout (Header/Footer/Details sections) using these properties:
UOM: Unit of measure (PIXEL/CM/INCH, matches Crystal Reports report units).- Set the target PDF417 image width and height using property
BarcodeWidthandBarcodeHeight
PDF417 barcode = new PDF417(); barcode.Data = "PDF-417"; barcode.UOM = UnitOfMeasure.INCH; barcode.BarcodeWidth = 3; barcode.BarcodeHeight = 1;
You can also further customize PDF417 dimensions to fit Crystal Reports layout (Header/Footer/Details sections) using these properties:
AutoResize: It must be false to enable propertyXandXtoYRatio.X: Module width (minimum defined by application specs).XtoYRatio: Bar width-to-height ratio (default: 0.3333333f).RowCount: Number of rows (3–90).ColumnCount: Number of columns (1–30).- LeftMargin/RightMargin/TopMargin/BottomMargin: Quiet zone (minimum 2X to avoid scanning errors).
Note: Ensure RowCount and ColumnCount align with the report’s PictureBox size to avoid layout overflow in Crystal Reports.
Advanced PDF417 Features for Crystal Reports (C#)
Error Detection and Correction (ECL)
PDF417 includes error correction codewords (2 minimum) to ensure scan reliability (critical for physical report printing).
Use the
Use the
ECL property to set the correction level in Crystal Reports ASP.NET, WinForms project:
| Error Correction Level | Total Error Correction Codewords | Use Case for Crystal Reports |
| 0 | 2 | Digital-only report distribution |
| 1 | 4 | Low-risk physical printing |
| 2 | 8 | Standard physical printing |
| 3 | 16 | High-wear report use (e.g., shipping labels) |
| 4 | 32 | Industrial report printing |
| 5 | 64 | Extreme environmental conditions |
| 6 | 128 | Mission-critical reports |
| 7 | 256 | - |
| 8 | 512 | - |
Compact (Truncated) PDF417
Create space-optimized PDF417 (for narrow Crystal Reports Details section) by enabling the
Truncated property in C# code:
PDF417 barcode = new PDF417(); barcode.Data = "PDF417"; barcode.Truncated = true;
Note: Truncated PDF417 is not recommended for reports prone to physical damage (e.g., outdoor labels).
Macro PDF417
Macro PDF417 is similar to QR Code, Data Matrix Structured Append mode.
Split large datasets (e.g. Crystal Reports Subreport data) across multiple PDF417 symbols:
Here are the PDF417 properties to create Macro PDF417 barcodes in Crystal Reports.
- Macro PDF417 supports up to 99,999 symbols per dataset.
- Each symbol includes control information to reconstruct data (regardless of scan order).
- Ideal for Crystal Reports with large Data Source datasets (e.g. enterprise-level Report scheduling).
Here are the PDF417 properties to create Macro PDF417 barcodes in Crystal Reports.
- Set
Macroto true to create macro PDF417 barcodes - In property
MacroFileIndexto choose random file id for this PDF417 file. - In property
MacroSegmentCountto specify the total number of segments for this PDF text file. In the C# example below, it is total 10 segements for the file. - In property
MacroSegmentIndexto specify the order of the current PDF417 in the all segments. The order of the first symbol is 0.
PDF417 barcode = new PDF417(); barcode.Data = "MacroPDF"; barcode.Macro = true; barcode.MacroFileIndex = 3; barcode.MacroSegmentCount = 10; barcode.MacroSegmentIndex = 2;
Summary
Now we have learned how to create, print PDF417 (a 2D stacked linear barcode symbology) in Crystal Reports and customize it using OnBarcode Barcode Generator for Crystal Reports C# library.
Print PDF417 in Report: Generate PDF417 in C# and bind it to Crystal Reports for .NET using ReportDocument, CrystalReportViewer, and .rpt file templates (compatible with ASP.NET Web Forms/WinForms PictureBox controls).
Process Complex Text Format: Use auto/manual encoding modes for ASCII/Unicode; handle non-printable characters with tilde processing (critical for Crystal Reports Formula field and Parameter field binding).
Customize PDF417: Customize dimensions, error correction levels, and compact mode to fit Crystal Reports layout (Header/Footer/Details sections), and use Macro PDF417 for large datasets in enterprise report distribution.
Print PDF417 in Report: Generate PDF417 in C# and bind it to Crystal Reports for .NET using ReportDocument, CrystalReportViewer, and .rpt file templates (compatible with ASP.NET Web Forms/WinForms PictureBox controls).
Process Complex Text Format: Use auto/manual encoding modes for ASCII/Unicode; handle non-printable characters with tilde processing (critical for Crystal Reports Formula field and Parameter field binding).
Customize PDF417: Customize dimensions, error correction levels, and compact mode to fit Crystal Reports layout (Header/Footer/Details sections), and use Macro PDF417 for large datasets in enterprise report distribution.
Common Asked Questions
What is the use of PDF417 barcode?
PDF417 is a high density, 2-dimensional stacked barcode symbology.
"PDF" stands for Portable Data File, and "417" signifies that each pattern in the code consists of 4 bars and spaces in a pattern that is 17 units (modules) long.
PDF417 barcodes are used in a variety of industries and applications, such as identification cards, driver's license, airline boarding pass, transport, and inventory management.
Using .NET Crystal Reports Barcode Generator library, you can quickly create, print and insert PDF417 barcodes in Crystal reports in Visual Studio ASP.NET Core, WinForms projects.
Using .NET Crystal Reports Barcode Generator library, you can quickly create, print and insert PDF417 barcodes in Crystal reports in Visual Studio ASP.NET Core, WinForms projects.
What is the maximum capacity of a PDF417?
According to PDF standard (ISO/IEC 15438), the maximum number of characters encodable in a PDF417 barcode with lowest error correction level (0).
- Text Compaction mode: 1,850 characters
- Byte Compaction mode: 1,108 characters
- Numeric Compaction mode: 2,710 characters
What is the aspect ratio of a PDF417?
The aspect ratio of the printed PDF417 barcode shall be defined by two dimensions:
X: set the dimension width of the narrowest bar and narrowest space.Y: set the dimension height of the narrowest bar and narrowest space.
X and Y.
What is the difference between a PDF417 and a QR Code?
PDF417 and QR Code are both 2D or matrix barcode symbologies.
PDF417 is a barcode with linear rows of stacked codewords, and QR Code usually consists of black squares arranged in a square grid on a white background.
PDF417 can be scannable even if up to 50% of it is damaged. QR Code can accept up to 30% damages. Crystal Reports for .NET Barcode library supports both PDF417 and QR Code 2d barcode generations in Crystal report designer and report viewer in Windows Forms, ASP.NET Core web and Windows applications.
PDF417 can be scannable even if up to 50% of it is damaged. QR Code can accept up to 30% damages. Crystal Reports for .NET Barcode library supports both PDF417 and QR Code 2d barcode generations in Crystal report designer and report viewer in Windows Forms, ASP.NET Core web and Windows applications.