The PDF-417 barcode control for RDLC is a robust reporting component that facilitates the creation of comprehensive reporting solutions with integrated barcode generation and printing capabilities. This library is compatible with VB.NET, C#, Managed C++, and Borland Delphi for .NET, and can be utilized in applications requiring RDLC based reporting.
How to Generate PDF-417 in RDLC Using the Barcode Generation SDK
This guide outlines the process of generating PDF417 2D barcodes within RDLC Local Reports using C#.
The approach is optimized for ASP.NET (including Web Forms and MVC) and Windows Forms (.NET Framework) projects integrated with the ReportViewer Control.
The guide is based on the following tutorials:
How to create barcodes in RDLC reports in ASP.NET
How to create barcodes in RDLC reports in Windows Forms
The existing demonstration code for Code 128 can be adapted to generate PDF-417 barcodes as described below.
Open the file Form1.cs in Visual Studio.
Comment out the existing Linear object construction code.
Create a new PDF417 object to generate and customize PDF417 barcodes in the RDLC report.
PDF-417 Barcode Data Encoding in RDLC Local Reports (C#)
Valid Character Sets
PDF-417 barcodes in RDLC reports support the following character encodings:
Full ASCII (128 standard characters)
Extended ASCII (values 128–255 per ISO 8859-1)
Up to 811,800 distinct character sets or data interpretations
Various function codewords for control purposes (compatible with RDLC Custom Code)
Encoding Data Modes
PDF-417 supports compact encoding modes optimized for different data types in RDLC reports:
Auto (default): The RDLC PDF-417 library automatically selects the optimized combination of compact modes.
Text Compaction: Encodes printable ASCII characters (32 - 126 per ISO/IEC 646 IRV) and selected control characters.
Byte Compaction: Encodes all 256 8 bit byte values (supports international character sets for RDLC).
Numeric Compaction: Efficiently encodes numeric data strings (ideal for large numeric datasets in RDLC).
The library auto selects the optimal mode for RDLC, or the mode can be set explicitly. The following C# code specifies the target data mode in an RDLC local report file (.rdlc).
Maximum Data Length
The maximum data capacity for PDF-417 with Error Correction Level 0 in RDLC reports varies by encoding mode:
Text Compaction: 1,850 characters
Byte Compaction: 1,108 characters
Numeric Compaction: 2,710 digits
Note: Higher error correction levels reduce the maximum data capacity. Exceeding these limits triggers PDF-417 encoding errors.
Macro mode (covered later) can be used for large text messages.
Encoding Text in PDF-417 for RDLC Local Reports (C#)
This section covers encoding different text types (ASCII, Unicode, non printable characters) into PDF-417 barcodes for RDLC reports in ASP.NET and Windows Forms projects.
Generate PDF-417 with ASCII Text (Including Non Printable Characters)
For printable ASCII characters (95 total), assign the text directly to the Data property.
For non printable ASCII characters (33 ASCII control characters):
Convert the character to ~ddd format, where ddd is a three digit ASCII value (e.g., carriage return = ~013).
Enable ProcessTilde = true to allow the library to parse the ~ddd format.
Note: Scan the generated PDF-417 in the RDLC report viewer (or in exported PDF/Excel) to confirm that non printable characters decode correctly.
Generate PDF-417 with Unicode Text
Enable EncodeUnicodeText = true to support multi language text (e.g., Chinese, French) in RDLC reports.
Ensure the RDLC Font setting (e.g., Arial Unicode MS) supports Unicode characters.
Note: Use a PDF-417 scanner device or software to verify that the Unicode PDF-417 renders correctly in the ReportViewer Control (Windows Forms) or in the browser (ASP.NET).
Other Supported Data Formats for RDLC
Binary Data: Encode files (e.g., PDFs) into PDF-417 using Byte Compaction mode (ideal for RDLC reports with embedded files).
ECI Mode: Support extended character sets (e.g., Arabic, Cyrillic) via Extended Channel Interpretation (ECI) mode.
PDF-417 Dimension Settings for RDLC Local Reports (C#)
Optimize PDF-417 dimension size for the RDLC Image report item to avoid distortion in printed or exported reports. Use BarcodeWidth and BarcodeHeight.
Add the following C# code to the RDLC Barcode ASP.NET or Windows Forms project.
Determine the PDF-417 printing size in the .rdlc file (matches BarcodeWidth and BarcodeHeight).
Use UOM to choose the preferred unit of measure (inch or cm).
Set BarcodeWidth and BarcodeHeight to specify the PDF-417 image rendering size.
Further Customize PDF-417 Dimension Size
In the C# PDF-417 generator for RDLC, the following properties can be used to customize barcode dimensions:
AutoResize: Must be false to enable the X and XtoYRatio properties.
X: Bar module width (minimum value defined by application specifications).
XtoYRatio: Bar width to height ratio (default: 0.3333333f).
Note: Check the RDLC report viewer to confirm that the PDF-417 barcode dimensions match the configured values (no stretching or compression). Adjust RowCount or ColumnCount if the encoded data exceeds the current symbol capacity; the barcode library auto adjusts if needed.
Advanced PDF-417 Options for RDLC Local Reports (C#)
PDF-417 Error Detection and Correction (ECL)
Every PDF-417 symbol in RDLC includes error correction codewords for reliability. The ECL property sets the error correction level (0 - 8), with higher levels providing better resilience (critical for printed RDLC reports).
Generate Compact (Truncated) PDF-417 for RDLC
Use Truncated PDF-417 for RDLC reports with limited space (low risk of symbol damage). Ensure that barcode scanners support Truncated PDF-417 (verify with the hardware vendor).
Note: Confirm that the truncated PDF-417 renders correctly in the RDLC report viewer, or in the printed PDF/Excel file, and scans without errors.
Generate Macro PDF-417 for RDLC
Macro PDF-417 splits large datasets across multiple PDF-417 symbols (similar to Structured Append mode in QR Code and Data Matrix), which is ideal for long RDLC reports with extensive data.
Splits data into blocks across up to 99,999 PDF-417 symbols.
Includes control information to reconstruct data regardless of scan order.
Compatible with RDLC Subreport controls for multi symbol display.
Note: Verify that all Macro PDF-417 symbols render in the RDLC report (use Tablix/List controls for layout) and scan to reconstruct the full dataset.
Summary
The core workflow for generating PDF-417 barcodes in an RDLC Local Report consists of the following steps:
Initialize the PDF-417 barcode object.
Configure PDF-417 encoding data and code set.
Generate the PDF-417 barcode byte stream.
Bind the byte stream to the RDLC Image report item.
Render the report through the ReportViewer Control (ASP.NET / Windows Forms).
Critical customization parameters for RDLC compatibility include:
Encoding mode (DataMode)
Dimension settings (X, RowCount / ColumnCount)
Error correction level (ECL)
These settings must align with the properties of the RDLC Image report item to ensure consistent rendering.