How to create, print UPC-A in SSRS Reports in ASP.NET, WinForms application?

Create UPC-A Barcodes in SSRS Reports Projects Using .NET Control

Generate & print UPC-A barcodes in SQL Server Reporting Services 2005, 2008, 2008R2, 2012, 2014

  • Generate UPC-A barcodes in Microsoft SQL Server Reporting Services (SSRS) reports.
  • Using Barcode Custom Report Item (CRI) for creating UPC-A, UPCA+2, UPCA+5.
  • Drag & drop UPC-A barcode report item to your Reporting Service report layout page.
  • Completely developed in C# managed code with digital signature.
  • Fully compatible with SQL Server Reporting Services 2005 and 2008 versions.
  • Reliable & mature UPC-A barcode generation for Reporting Service using .NET Barcode Generator.
Here we will explain how to generate UPC-A barcode (a 12-digit linear barcode symbology primarily used for retail product identification in North America) in your SQL Server Reporting Service (SSRS) reports using C#.
  • Step-by-step instructions to generate UPC-A barcodes in SSRS Paginated Reports using a SSRS Barcode Generator library.
  • All UPC-A property settings are configured exclusively in theReport Item Property pane during report design in SSRS
  • Detailed coverage of UPC-A core features: quick generation, customization options (quiet zone indicator, digit spacing, font size), and check digit calculation, all tailored for SSRS integration








Deploy and Config Barcode Generator CRI into your Reporting Service projects

Top




UPC-A Barcode Generator Custom Report Item - UPC-A Barcode Parameters

Top
Category Properties Value Comments
Basic Property: Data
URL: DATA
Type: string
Default: "12345"
Barcode value to encode

UPC-A Valid Data Char Set:
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (Digits)

UPC-A Valid data length:
  • 11 digits only, excluding the last checksum digit.

Property: Type
URL: TYPE
Type: BarcodeType
Default: CODE128 (7)
Linear barcode symbology type.

Set the value to BarcodeType.UPCA or BarcodeType.UPCA_2 or BarcodeType.UPCA_5.

UPC-A type values are BarcodeType.UPCA (36), BarcodeType.UPCA_2 (37), BarcodeType.UPCA_5 (38).
Property: AddCheckSum
URL: ADD-CHECK-SUM
Type: bool
Default: false
AddCheckSum property is not applied here. .NET Barcode will always add a check character in the last digit (modulo 10).
 
UPC-A Related Property: SupData
URL: SUP-DATA
Type: string
Default: ""
Set the supplement data to encode. Valid values are 2 or 5 digits
Property: SupHeight
URL: SUP-HEIGHT
Type: float
Default: 0.8f
This is a multiplicator of the height of the bar module; The default is 0.8 (80% of Y - bar module height).
Property: SupSpace
URL: SUP-SPACE
Type: float
Default: 15
The separation between the barcode and the supplement. Default is 15 pixel.
 
Barcode
Size
Related
Property: AutoResize
URL: AUTO-RESIZE
Type: bool
Default: false
Auto resize the generated barcode image
Property: BarAlignment
URL: BAR-ALIGNMENT
Type: int
Default: 1 (center)
Barcode horizontal alignment inside the image. 0: left, 1: center, 2: right.
Property: UOM
URL: UOM
Type: UnitOfMeasure
Default: PIXEL (0)
Unit of meature for all size related settings in the library.

Valid values:
  • UnitOfMeasure.PIXEL (0)
  • UnitOfMeasure.CM (1)
  • UnitOfMeasure.INCH (2)
Property: X
URL: X
Type: float
Default: 1
Width of barcode bar module (narrow bar), default is 1 pixel
Property: Y
URL: Y
Type: float
Default: 60
Height of barcode bar module, default is 60 pixel
Property: BarcodeWidth
URL: BARCODE-WIDTH
Type: float
Default: 0
Barcode image width.

If barcodeWidth setting is smaller than the barcode required minimum width, the library will automatically reset to barcode minimum width.
Property: BarcodeHeight
URL: BARCODE-HEIGHT
Type: float
Default: 0
Barcode image height.

If barcodeHeight setting is smaller than the barcode required minimum height, the library will automatically reset to barcode minimum height.
Property: LeftMargin
URL: LEFT-MARGIN
Type: float
Default: 0
Barcode image left margin size.
Property: RightMargin
URL: RIGHT-MARGIN
Type: float
Default: 0
Barcode image right margin size.
Property: TopMargin
URL: TOP-MARGIN
Type: float
Default: 0
Barcode image top margin size.
Property: BottomMargin
URL: BOTTOM-MARGIN
Type: float
Default: 0
Barcode image bottom margin size.
Property: Resolution
URL: RESOLUTION
Type: int
Default: 72
Barcode image resolution in DPI (Dots per inch).
Property: Rotate
URL: ROTATE
Type: Rotate
Default: Rotate0 (0)
Valid values:

  • Rotate.Rotate0 (0)
  • Rotate.Rotate90 (1)
  • Rotate.Rotate180 (2)
  • Rotate.Rotate270 (3)
 
Barcode
Colors
Property: BackColor
URL: BACK-COLOR
Type: Color
Default: white
Barcode image background color
Property: ForeColor
URL: FORE-COLOR
Type: Color
Default: black
Barcode image foreground color
 
Font
Style
Property: ShowText
URL: SHOW-TEXT
Type: bool
Default: true
If true, display barcode data text under the barcode, otherwise do not display.
Property: TextFont
URL: TEXT-FONT
Type: Font
Default:
new Font("Arial", 9f, FontStyle.Regular)
Barcode text font style.

In ASP.NET web streaming, using the url paramter in the following format:
&TEXT-FONT=Arial|9|regular
Property: TextMargin
URL: TEXT-MARGIN
Type: float
Default: 6
Space between barcode and barcode data text, default is 6 pixel
Property: TextColor
URL: TEXT-COLOR
Type: Color
Default: black
Barcode text color
 
Image
Format
Property: Format
URL: FORMAT
Type: ImageFormat
Default: Png
Barcode image encoding type.
 
Methods
// generate barcode and encode to image file
public void drawBarcode(string filename)

// generate barcode and paint on Graphics object
public void drawBarcode(Graphics graphics)

// generate barcode and paint on Bitmap object
public Bitmap drawBarcode()

// generate barcode and paint on Stream object
public void drawBarcode(Stream fileStream)

// generate barcode and paint on byte[] object
public byte[] drawBarcodeAsBytes()
 
In WebStream query string, please use int value for Enums, "true" and "false" for bool.


Customize UPC-A Barcode in SSRS Reports

Using the OnBarcode SSRS Barcode Generator library, you can customize your UPC-A barcode to fit your SSRS report's layout and compliance requirements. The following customization options are available, all configured in the Report Item Property pane:
  • ShowQuietZoneIndicator: Displays or hides the UPC barcode quiet zone indicator. The default value is true.
  • UPCEANLeadDigitSpace: Sets the space between the first digit and the start character bar. The default value is 0.
  • UPCEANTrailDigitSpace: Sets the space between the stop character bar and the quiet zone indicator. The default value is 0.
  • UPCEANLeadTrailDigitSizeRatio: Controls the font size of the first and last digits relative to the rest of the digits. The default value is 1.0f (all digits same size).
Let's walk through each customization option and how to apply them in your SSRS report.


UPC-A Quiet Zone Indicator

The quiet zone indicator is a small mark at the end of the UPC-A barcode. It denotes the end of the quiet zone (empty space around the barcode), which is critical for scannability.

By default, the C# Barcode Generator library displays this indicator in your SSRS report.

To hide the quiet zone indicator:
  • Set the ShowQuietZoneIndicator property to false in the Report Item Property pane.



Note: Hiding the quiet zone indicator does not remove the quiet zone itself. Ensure the quiet zone (LeftMargin and RightMargin) meets UPC standards (minimum 9X) to maintain scannability in your SSRS report.


UPC-A First, Last Digit Space, Position, and Font Size

You can adjust the spacing, vertical position, and font size of the first and last digits of the UPC-A barcode to improve readability or fit your SSRS report's layout.

Adjust Digit Spacing

Use the following properties to increase the space around the first and last digits (configured in the Report Item Property pane):
  • UPCEANLeadDigitSpace: Increases the space between the first digit and the start bar.
  • UPCEANTrailDigitSpace: Increases the space between the stop character bar and the quiet zone indicator.

Adjust Vertical Position of Digits

Use the following properties to adjust the vertical offset of the first and last digits (configured in the Report Item Property pane):
  • UPCEANLeadDigitYShift: Controls the vertical offset of the first digit in the UPC-A barcode text.
  • UPCEANTrailDigitYShift: Controls the vertical offset of the last digit in the UPC-A barcode text.



Note: Negative values shift the digit upward, while positive values shift it downward.

Adjust Digit Font Size

se the UPCEANLeadTrailDigitSizeRatio property to customize the font size of the first and last digits relative to the rest (configured in the Report Item Property pane). The value represents the ratio of the first/last digit font size to the rest of the digits (e.g., 0.6f means the first/last digits are 60% the size of the other digits).


UPC-A Check Digit Calculation in SSRS Reports

The UPC-A check digit is a critical component for data integrity. It is calculated using a modulo 10 algorithm, based on the weighted sum of the first 11 digits (which include the UPC number system, manufacturer code, and product code). Follow these steps to calculate the UPC-A check digit manually (useful for validating your SSRS dataset data before encoding):
  1. Consider the right-most digit of the 11-digit data as being in an "odd" position. Assign odd/even positions to each digit by moving from right to left.
  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 two totals calculated in steps 2 and 3.
  5. The check digit is the number that, when added to this total, results in a number evenly divisible by 10.
  6. If the total from step 4 is already evenly divisible by 10, the check digit is "0" (not 10).
Example: If your SSRS dataset Field contains the 11-digit UPC-A data "12345678901", the correct check digit is "2". The full 12-digit UPC-A code would be "123456789012".

Note: If you provide 11 digits in the Data property (bound to your SSRS dataset Field), the SSRS Barcode Generator library will automatically calculate the check digit. If you provide 12 digits, ensure the 12th digit is the correct check digit. Otherwise, the library will generate an invalid UPC-A barcode that cannot be scanned.












Common Asked Questions

What is a GTIN-12 UPC-A barcode?

GTIN-12 is a 12 digits Global Trade Item Number. It is usually encoded in UPC-A barcode. The 12 digits Global Trade Item Number includes 11 digits of data message, and one digit of check sum digit. Using SQL Server Reporting Services Barcode Generation Library, you can input 12-digit GS1 numeric data or 13-digits data with checksum digit in SSRS report barcode item data source.

What is the difference between UPC-A and UPC-E?

Both of UPC-A and UPC-E are UPC barcode. UPC-A is a 12-digit barcode, and UPC-E is a compressed UPC-A with 6 digits code. The UPC-E will be used in limited space for a barcode. You can create both UPC-A and UPC-E images in SSRS reports in report designer and preview UPC barcode in report viewer using .NET SQL Server Reporting Services barcode library.

What is the difference between EAN-13 and UPC-A?

UPC-A Format barcodes have traditionally been used in the North America (USA and Canada), whereas EAN-13 format barcodes have been used throughout the rest of the world. SQL Server Reporting Services Barcode Generator SDK supports both UPC and EAN with add-on symbol barcode generation in SSRS reports in .NET C#/VB.NET class, ASP.NET Core, WinForms, WPF applications.

What is the minimum & maximum size for a UPC-A barcode?

  • The Minimum X-dimension for the UPC-A barcode is 0.0104 inches.
  • The Maximum X-dimension for the UPC-A barcode is 0.0260 inches
You can apply the UPC-A barcode X-dimension and Y-dimension in SSRS report item proeprty settings in report designer using OnBarcode .NET SQL Server Reporting Services Barcode Generator library.












































































Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.