KA.Barcode for .NET Suite
How to Generate UPC-A in C# Application
How to Generate Linear UPC-A Barcode Images in C#, ASP.NET, WinForms, Crystal & RDLC

C# UPC-A barcode generator: how to calculate, generate UPC barcode with check digit, c# example source code



  • Fully compatible with .NET Framework 2.0, 3.0, 3.5 and above to print UPC-A in .NET development environment
  • Accurate algorithm to automatically add checksum digit for UPC-A in accordance with GS1 specifications
  • Draw and print 1D UPC-A, UPC-A+2, UPC-A+5 barcodes in Visual C#.NET class & console applications
  • Generate and print UPC-A barcodes in ASP.NET, WinForms, Crystal Reports & RDLC Reports
  • C#.NET programming to generate UPC-A images in Png, Jpeg, Gif, Tiff & Bmp image formats
  • Rotate the generated linear UPC-A pictures in 0, 90, 180 and 270 degrees
  • Support UPC-A color, font, width, height & resolution customization in C#.NET
C# UPC-A Barcode Control Introduction
KeepAutomation Barcode Generator API for .NET is a professional barcode encoder component SDK especially designed to help developers easily add 1D UPC-A barcoding feature in .NET projects using C#.NET programming. Besides, various barcoding settings are available for users to customize the generated UPC-A barcode images with this encoder.
UPC-A Barcode Introduction
UPC-A is GS1 barcode symbology 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.
  • UPC-A Encodable Data: numeric digits 0-9
  • UPC-A Data Capacity: 12 digits (the last checksum digit will automatically added by KeepAutomation's software)
UPC-A Barcode Creation in ASP.NET Using C#
It is simple to generate UPC-A barcode images in ASP.NET web pages as well as Microsoft IIS with this barcode creation control for .NET. A detailed tutorial with C# sample code is provided for users. When using the sample code to generate UPC-A barcode images, users need to download our free trial version of this control online. Then, it is necessary for them to add "KeepAutomation.Barcode.Web.dll" to their project reference. Here are detailed steps: How to print barcode in Visual C# with ASP.NET web control.
UPC-A Barcode Generation in .NET Windows Forms Using C#
With this .NET barcode generator SDK, you can create standard UPC-A barcode images in .NET WinForms. The generated barcode images can be saved in multiple image formats, including gif, tiff, png etc. You may refer to this user guide page for UPC-A barcode creation in .NET WinForms: How to create barcode in .NET WinForms with Visual C#.
UPC-A Barcode Making in Crystal Reports Using C#
Downlaod of .NET Barcode Generator DLL trial is free of charge. Unzip it for easy installation. To generate high quality UPC-A barcode images in Crystal Reports, simply follow detailed barcode generation steps shown in the developer guide page: How to create barcode in Crystal Reports with Visual C#.
UPC-A Barcode Adding in RDLC Reports Using C#
This .NET barcode control is completely developed in Visual C# and it supports Visual Studio 2005 and above versions. With this dll, developers can easily integrate UPC-A barcode images in Visual Studio ReportViewer Local Reports. Please refer to: How to create barcode in RDLC Reports with C# code.
UPC-A Barcode Generation in .NET Applications with C#
Developers can create advanced UPC-A barcodes in .NET applications using C# class library with this barcode control. A complete generation guide with detailed C# sample code is offered online. Download the evaluation version of this barcode control to generate customized UPC-A barcode images by resetting UPC-A barcode properties.
C# Sample code
     BarCode upca = new BarCode();
// Set barcode symbology type to UPCA, UPCASup2, UPCASup5
upca.Symbology = KeepAutomation.Barcode.Symbology.UPCASup2;
// Set UPC-A encoding code value. Valid input: 0-9. Length: 11 digits without checksum.
upca.CodeToEncode = "11223344551";
// Unit of measure, Pixel, Cm and Inch supported.
upca.BarcodeUnit = BarcodeUnit.Pixel;
// UPC-A image resolution in DPI.
upca.DPI = 72;

//Apply checksum for UPC-A barcode.
upca.ChecksumEnabled = true;
// Display checksum in the UPC-A barcode text
upca.DisplayChecksum = true;

// Set UPC-A image size

// UPC-A bar module width (X dimention), default value is 1 pixel.
upca.X = 2;
// UPC-A bar module height (Y dimention), default is 50 pixel.
upca.Y = 60;
// Image left margin size, 10X is automatically added to go with specification.
upca.LeftMargin = 0;
// Image right margin size, 10X is automatically added to go with specification.
upca.RightMargin = 0;
// UPC-A image top margin size
upca.TopMargin = 0;
// UPC-A image bottom margin size
upca.BottomMargin = 0;
// UPC-A orientation, 90, 180, 270 degrees supported
upca.Orientation = KeepAutomation.Barcode.Orientation.Degree0;

// UPC-A supplement code of 2 or 5 digits
upca.SupplementCode = "02";
// UPC-A supplement bar height vs primary bar height ratio.
upca.SupplementHeight = 0.7f;
// Space between barcode and supplement barcode
upca.SupplementSpace = 15;

// Set UPC-A human readable text style

// Display human readable text
upca.DisplayText = true;
upca.TextFont = new Font("Arial", 10f, FontStyle.Regular);
// Space between barcode and text
upca.TextMargin = 6;

// enerate UPC-A barcodes in image format JPEG
upca.generateBarcodeToImageFile("C://barcode-upca-csharp.jpeg");

/* Create UPC-A barcodes in Stream object
upca.generateBarcodeToStream(".NET System.IO.Stream Object");

Draw & Print UPC-A barcodes to Graphics object
upca.generateBarcodeToGraphics(".NET System.Drawing.Graphics Object");

Generate UPC-A barcodes & write to byte[]
byte[] barcodeInBytes = upca.generateBarcodeToByteArray();

Bitmap barcodeInBitmap = upca.generateBarcodeToBitmap();
*/