KA.Barcode Generator for .NET Suite
How to Print UPC-A in C# with Valid Data
Complete C#.NET source code to generate UPC-A images using Barcode Generator for .NET Control
  • Easily create 1D UPC-A, UPC-A +2, UPC-A +5 linear bar code images using C#.NET programming
  • Generating, printing high-quality UPC-A barcodes in WinForms, inserting images in ASP.NET web applications
  • Easy generation procedure to insert UPC-A barcode images in Crystal Reports, SQL Server Reporting Services, etc
  • Simple UPC-A barcoding and printing using Visual C#, VB.NET programming
  • Provide detailed C# barcode integration, .NET barcode guide & .NET WinForms barcode guide guides for users
  • Detailed tutorial with sample code provided to encode valid data for UPC-A images
  • Create and save generated UPC-A barcodes in Png, Jpeg, Gif, Tiff, Bmp image formats
  • Compatible with latest GS1 UPC-A barcode specifications for best image output
  • Other barcode solutions provided - Word barcode, barcode .NET, barcode .NET WinForms, etc.
  • Checksum digit, quiet zones automatically added by KA.Barcode as specified in standard
KA.Barcode Generator for .NET Suite can help you easily generate 1D UPC-A, UPC-A with two-digit add-on symbol, UPC-A with five-digit add-on symbol in C#.NET class library. This page is a demo code tutorial to help you encode valid data to produce, integrate UPC-A barcode images in .NET. You can get more information on resizing and image setting for UPC-A images here:
UPC-A Introduction
UPC-A, is also named as Universal Product Code version A, UPC-A+2, UPC-A Supplement 2 (Two-digit Add-On), UPC-A+5, UPC-A Supplement 5 (Five-digit Add-On), UPC Bar Code, UPC Symbol, GTIN-12, GS1-12.

Valid Data

  • Numeric digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Valid Length

  • UPC-A barcode can encode 12 digits, including the last checksum digit, which will be automatically added by KA.
UPC-A Data Encoding in KA.Barcode Generator for .NET Suite

Install KA.Barcode Generator for .NET Suite

  1. 1.
  2. 2.
    Add Reference: Add "KeepAutomation.Barcode.Window.dll" to your .NET WinForms project reference.
  3. 3.
    Copy the C#.NET samples below for valid UPC-A barcode generation in .NET projects.

Numeric Data for UPC-A

A UPC-A barcode can encode 12 numeric digits. However, KA.Barcode Generator for .NET Suite will automatically calculate and add the last checksum digit as specified in the GS1 barcode standard, so you can simply input 11 numeric digits as data.
using KeepAutomation.Barcode.Bean;

BarCode upca= new BarCode();
upca.Symbology = KeepAutomation.Barcode.Symbology.UPCA;
upca.CodeToEncode = "11223344556";
upca.X = 2;
upca.generateBarcodeToImageFile("C:/upca_csharp.png");

Numeric Data for UPC-A+2

You can also add a two-digit add-on symbol for an UPC-A barcodes. Simply follow the C#.NET sample code below to print a UPC-A bar code with a 2-digit supplement data.
using KeepAutomation.Barcode.Bean;

BarCode upca= new BarCode();
upca. Symbology = Symbology. UPCASup2;
upca.CodeToEncode = "11223344556";
upca.SupplementCode = "22";
upca.X = 2;
upca.generateBarcodeToImageFile("C:/upca_add2.png");

Numeric Data for UPC-A+5

In case you want to encode some extra information into the barcode, you might refer to a five-digit add-on symbol for an UPC-A barcodes. Follow the sample code below to print an UPC-A+5 bar code.
using KeepAutomation.Barcode.Bean;

BarCode ean13= new BarCode();
ean13.Symbology = KeepAutomation.Barcode.Symbology.UPCASup5;
ean13.CodeToEncode = "11223344556";
ean13.SupplementCode = "55555";
ean13.X = 2;
ean13.generateBarcodeToImageFile("C:/upca_add5.png");