Home  >  .NET Barcode Generator Suite  >  .NET Barcode Generation Guide  >  Guide to Generate & Create UPC-A Barcode Using .NET Barcoding Control
.NET Barcode UPC-A Generator for C# & VB.NET Applications
.NET Barcode UPC-A Generator Library is a mature and professional .NET barcoding contrl. This UPC-A barcode generating library can be easily integrated into .NET developing tools, like Visual Studio. It supports using C# & VB.NET class code to generate & print UPC-A barcode images in .NET applications.
.NET UPC-A Linear Barcode Introduction
UPC-A is also known as Universal Product Code version A, UPC-A Supplement 5/Five-digit Add-On, UPC-A Supplement 2/Two-digit Add-On, UPC-A+5, UPC-A+2, UPC Code, UPC Symbol, GTIN-12, GS1-12, UCC-12.
UPC-A is used for marking products which are sold at retail in the USA. The barcode identifies the manufacturer and specific product so point-of- sale cash register systems can automatically look up the price.
The UPC-A Code and the assignment of manufacturer ID numbers is controlled in the U.S.A. by the Uniform Code Council (UCC).
How to Create UPC-A Barcodes using .NET Windows Form Barcode Generator Control
Following steps are used to generate & create UPC-A barcode images in WinForms project by using .NET barcode generating library:
  1. Find KeepDynamic.BarCode.Windows.dll and install it to your WinForms project and .NET developing toolbox
  2. Drag & drop the BarCodeControl item from Visual Studio toolbox to your windows forms project
  3. Click generated barcode image (which is the default Code 128 barcode image), change the value of SymbologyType to UPCA and encode a 11-digit data at CodeText in the Properties window
  4. Then run your .NET WinForms project and a UPC-A barcode image will be generated
How to Create UPC-A Barcodes using ASP.NET Web Barcoding Control
Following tutorial helps .NET developers generate & create UPC-A barcode images in ASP.NET web application by using .NET barcode generating library:
  1. Add KeepDynamic.BarCode.AspNet.dll to your ASP.NET web project reference and Visual Studio toolbox
  2. Copy "linear.aspx", "linear.aspx.cs" from folder barcode to your ASP.NET project
  3. Drag & drop BarCodeControl item from toolbox to your ASP.NET Web pages
  4. Click created barcode image, change the value of SymbologyType to UPCA and encode a 11-digit data at CodeText in the Properties window
  5. Run your ASP.NET web project and view generated UPC-A barcode image
How to Generate UPC-A Barcode Images using C#.NET Code?
The following C#.NET code illustrates how to generate & print a UPC-A barcode image in C# class:
// generate linear barcode object 
BarCode barcode = new BarCode();

// Set barcode type to upca
barcode.SymbologyType = SymbologyType.UPCA;

// Enter a 11-digit data string
barcode.CodeText = "12345678912";

// set size-related settings of UPC-A barcode image
// Set bar width of UPCA
barcode.X = 2;

// set EAN13 barcode image
barcode.BarCodeWidth = 250;
barcode.BarCodeHeight = 90;

// save generated barcode images to png image file using C#
barcode.drawBarcode("C://kdupca.png");
More free sample C# code to generate & customize UPC-A barcode images in .NET application
How to Generate & Print UPC-A Barcode Images using VB.NET Code?
The following VB.NET code is used to generate & output a UPC-A barcode image in C# class:
' generate linear barcode object 
Dim barcode As New BarCode()

' Set barcode type to upca
barcode.SymbologyType = SymbologyType.UPCA

' Enter a 11-digit data string
barcode.CodeText = "12345678912"

' set size-related settings of UPC-A barcode image
' Set bar width of UPCA
barcode.X = 2

' set EAN13 barcode image
barcode.BarCodeWidth = 250
barcode.BarCodeHeight = 90

' save generated barcode images to png image file using VB.NET
barcode.drawBarcode("C://kdupca.png")
More free sample VB.NET code to generate & customize UPC-A barcode images in .NET application
.NET UPC-A Barcodes Properties

Barcode properties HTTP Parameters Default Comments
UPC-A specific properties SymbologyType symbology-type SymbologyType.Code128 The symbology or the barcode type. To create UPC-A barcode, change the default value to one of the below values:

  • SymbologyType.UPCA (36),
  • SymbologyType.UPCA_2 (37),
  • SymbologyType.UPCA_5 (38)
CodeText code-text "" This is the property that is used to encode the data message into the barcode

  • Valid character set: any number of 0-9
  • Valid data length: 11 data digits, excluding the 1 check digit
EnableChecksum enable-checksum true UPC-A symbology uses 1 checksum digit and KeepDynamic's barcode generator always add the check digit to UPC-A barcode automatically. The property of EnableChecksum can not be disabled to UPC-A
SupplementData supplement-data "none" The 2-Digit supplement (EAN2) and 5-Digit supplement (EAN5) to UPC barcode. To add the EAN2 or EAN5 to UPC-A, set the symbology type as

  • SymbologyType.UPCA_2,
  • SymbologyType.UPCA_5
SupplementSpace supplement-space 15 Barcode supplementary space between main barcode and supplement barcode. only valid for EAN-8, EAN-13, UPC-A, UPC-E, ISBN, ISSN
Symbology properties X x 2 The width of narrow bars and the default value of X is 2 pixels.

You can increase the value of X to enhance the readability of the barcode if the barcode scanners could not read stably the barcode which is set as the default value in X dimension.
Y y 75 Height of a barcode module

The default bar height value is 75 pixels
Resolution resolution 72 This property set the resolution in DPI of a barcode image to be drawn, and the default value that is set to printer is 72 pixels. You can adjust the value to get a custom resolution barcode image.
GraphicsUnit graphics-unit GraphicsUnit.Pixel This is the barcode graphic measurements for all size related settings. There are three type of measurements:
  • 0: pixel;
  • 1: cm;
  • 2: inch.
The default value is pixel
Rotate rotate 0 The Rotate property allows you changing the angle of a barcode. The valid values are:
  • Rotate0: do not rotate the barcode
  • Rotate90: rotate the barcode 90 degrees clockwise
  • Rotate180: rotate the barcode 180 degrees clockwise
  • Rotate270: rotate the barcode 270 degrees clockwise
DisplayCodeText display-code-text true The default value is true, which makes the encoded data message human readable. Otherwise the data message text will not be displayed on the barcode image
CodeTextFont code-text-font "Arial", Font.PLAIN, 11 CodeTextFont property is used for changing the font style of data message text that can be read by human eyes.
Image properties Format format ImageFormat.Png This is a method that is used for exporting barcode to different type of image formats. It allows developers generate barcode in formats like JPEG/JPG, BMP, GIF, and PNG.

The default method is ImageFormat.Png. Image format type. Using System.Drawing.Imaging.ImageFormat
LeftMargin left-margin 0 The property to set the distance between the symbol and the left margin of a barcode image.
RightMargin right-margin 0 The property to set the distance between the symbol and the right margin of a barcode image.
TopMargin top-margin 0 The property to customize the space between the symbol and the top margin on a barcode image
BottomMargin bottom-margin 0 The property to change the space between the symbol and the bottom margin on a barcode image

How to Generate other 1D & 2D Barcode Images using .NET UPC-A Barcoding Library