RDLC Barcode How-Tos
PM > Install-Package BarcodeLib.RDLC


In this article
Home > .NET RDLC Reports Barcode > RDLC Reports Barcode Generation Guide > UPC-A Barcode Generation Guide in RDLC Reports

.NET RDLC Reports UPC-A Barcode Generator

How to create, print UPC-A in .NET RDLC reports
The UPC-A barcode control library SDK for RDLC local reports supports the generation and creation of UPC-A barcode images with flexible property settings. Users can customize every aspect of the generated UPC-A barcode, including size, rotation, resolution, and color, to meet specific requirements.



How to Generate UPC-A in .NET RDLC Local Report Barcode SDK

This guide provides a streamlined process for creating and integrating UPC-A barcodes into RDLC Local Reports using C#. The approach is optimized for ASP.NET (including ASP.NET Framework and MVC) and Windows Forms (.NET Framework) projects integrated with the ReportViewer Control.

BarcodeLib provides step by step tutorials for printing barcodes in RDLC reports using C# in ASP.NET and Windows Forms applications.
  • How to create barcodes in RDLC reports in ASP.NET
  • How to create barcodes in RDLC reports in WinForms
The existing demonstration code for Code 128 can be adapted to generate UPC-A barcodes as follows.
  • Open the file Form1.cs in Visual Studio.
  • Change the barcode type from BarcodeType.CODE128 to BarcodeType.UPCA.
  • Ensure the UPC-A data is either 11 or 12 digits.


How to create barcode with specified size in C#?

The BarcodeLib C# Barcode Generator library enables granular customization of UPC-A barcodes for RDLC reports using the following key properties, optimized for ASP.NET and WinForms integration:
  • ShowQuietZoneIndicator: Show or hide the UPC quiet zone indicator (default = true).
  • UPCEANLeadDigitSpace: Space between the first digit and the start character bar (default = 0).
  • UPCEANTrailDigitSpace: Space between the stop character bar and the quiet zone indicator (default = 0).
  • UPCEANLeadTrailDigitSizeRatio: Font size ratio of the first and last digits relative to the other digits (default = 1.0f).
  • UPCEANLeadDigitYShift / UPCEANTrailDigitYShift: Vertical offset of the first and last digits (adjusts position in RDLC).


Customize UPC-A Quiet Zone Indicator for RDLC

The UPC-A quiet zone indicator can be shown or hidden in RDLC reports.


Note: Test the setting to ensure that the barcode does not overlap with other RDLC report items (e.g., TextBox, Line).


Customize UPC-A Digit Position and Font Size for RDLC

Adjustments can be made to the UPC-A text label digit spacing and position to align with UPC-A barcode symbology in RDLC Header, Footer or Table elements.
  • TextFont: Specify the UPC-A text font family and size. GS1 recommends an OCR font.
  • UPCEANLeadDigitSpace: Space between the first digit and the start character bar.
  • UPCEANTrailDigitSpace: Space between the stop character bar and the quiet zone indicator.
  • UPCEANLeadTrailDigitSizeRatio: Font size ratio of the first and last digits relative to the other digits.
  • UPCEANLeadDigitYShift / UPCEANTrailDigitYShift: Vertical offset of the first and last digits.



Note: Preview or print the RDLC report to confirm that UPC-A digits are positioned correctly without overlapping quiet zones or other report elements. Excessively large UPCEANLeadDigitSpace values may cause the barcode to exceed the RDLC Image report item bounds. Test with sample data before final implementation.


Calculating UPC-A Check Digit for RDLC Reports (C#)

UPC-A barcodes require a mandatory check digit (MOD 10 calculation) for data integrity in RDLC reports. The library automatically calculates this digit, but understanding the logic ensures valid data input for RDLC.


UPC-A Check Digit Calculation

  1. Assign odd/even positions to digits, starting from the rightmost digit (rightmost = odd, moving left = even).
  2. Sum the digits in all odd positions, then multiply the result by 3.
  3. Sum the digits in all even positions.
  4. Add the totals from steps 2 and 3.
  5. The check digit is the number that makes this total divisible by 10. If the total is already divisible by 10, the check digit is 0.


Example for RDLC Data Validation

  1. Input UPC-A data: 12345678901 (11 digits)
  2. Calculated check digit: 2
  3. Full UPC-A code (for RDLC): 123456789012


Summary

The core workflow for generating UPC-A barcodes in an RDLC Local Report is as follows:
  • Initialize a Linear barcode object.
  • Input 11 digit or 12 digit UPC-A data.
  • Set the barcode type to BarcodeType.UPCA.
  • Generate and customize the UPC-A barcode byte stream.
  • Bind the barcode binary data to the RDLC Image report item.
  • Render the report through the ReportViewer Control (ASP.NET / WinForms).
Key UPC-A customizations for RDLC include:
  • Quiet zone indicator visibility (ShowQuietZoneIndicator).
  • Digit spacing (UPCEANLeadDigitSpace and UPCEANTrailDigitSpace).
  • Digit font size and position (UPCEANLeadTrailDigitSizeRatio, UPCEANLeadDigitYShift, and UPCEANTrailDigitYShift).
Critical UPC-A rules for RDLC report:
  • Mandatory MOD 10 check digit (automatically calculated by the library).
  • Compliance with quiet zone standards.
  • Validation of input data (11 or 12 digits) to avoid encoding errors in ASP.NET and WinForms projects.
These settings must align with the properties of the RDLC Image report item to ensure accurate rendering.

Client RDLC Reports Barcode Generator SDK Supported Symbologies
Linear (1D) Barcodes:
Matrix(2D) Barcodes:
.NET RDLC Reports Barcode DLL Creates Linear Barcodes: Code 39, Code 128, EAN-13, EAN 128/GS1 128, UPC-A.
.NET RDLC Reports Barcode DLL Creates 2D Barcodes: Data Matrix, PDF 417, QR Code.



Related Developer Guide: How to Generate Barcode Images

How to generate barcodes in RDLC Reports for ASP.NET & .NET WinForms projects