Home  >  Barcode Component Suite for .NET  >  Tutorial on Barcode Creator Integration with C#  >  C#.NET UPC-A Barcode Generator Control Package
C# UPC-A Barcode Generator Library
C# UPC-A Barcode Generator Suite can be used to integrate UPC-A barcode generating features into C#.NET applications. KeepDynamic.com offers free C# sample code to generate & create UPC-A barcode images in .NET project, ASP.NET web application and Windows Forms project.
C# UPC-A Barcode Generator Library Suite Overview
Keepdynamic.com supplies .NET Barcode Generator Suite for the generation of linear UPC-A barcodes in C#.NET projects. 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.
Related barcode creating solutions for generating UPC-A barcode in C#.NET Framework applications.
C#.NET UPC-A Barcode Generator Suite Features

Technologies of UPC-A C#.NET Creator Library Suite

Customization of C#.NET UPC-A Barcodes Generation

View more about supported UPC-A Barcode Properties in C#.NET Barcode Generator Library Suite.
Generate UPC-A Barcode Using C#.NET Class Code
/*
create a new linear barcode object in C#.NET
and select the barcode symbology as UPC-A from barcode type list
*/
BarCode barcode = new BarCode();
barcode.SymbologyType = SymbologyType.UPCA;

/*
set data characters that are encoded into UPC-A barcode symbology
Valid data set of UPC-A consists of numeric digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
UPC-A barcode encodes a fixed data length of 11 data digits plus 1 check digit
*/
barcode.CodeText = "12345678901";

/*
enbable checksum option for UPC-A
so that .NET barcode generator computes and add check digit to UPC-A automatically
*/
barcode.EnableChecksum = true;

// set barcode graphics measurement as Pixel for UPC-A
barcode.GraphicsUnit = KeepDynamic.Barcode.Generator.GraphicsUnit.Pixel;

// assign the value of bar width and bar height for UPC-A barcode
barcode.X = 1;
barcode.Y = 75;

// set barcode symbol width & height for UPC-A barcode
barcode .BarCodeWidth =140;
barcode .BarCodeHeight =120;

// set margins around UPC-A symbol
barcode.LeftMargin = 10;
barcode.RightMargin = 10;
barcode.TopMargin = 10;
barcode.BottomMargin = 10;

/*
assign a value to resolution for UPC-A image
and change the orientation of UPC-A barcode image
*/
barcode.Resolution = 72;
barcode.Rotate = Rotate.Rotate0;

/*
display characters encoded into UPC-A symbology and
set the font style of data characters encoded into UPC-A
*/
barcode.DisplayCodeText = true;
barcode.CodeTextFont = new System.Drawing.Font("Arial", 11f, System.Drawing.FontStyle.Regular);

/*
set UPC-A barcode drawing image format to PNG in C# and
generate UPC-A image in C#
*/
barcode.Format = System.Drawing .Imaging .ImageFormat.Png;
barcode.drawBarcode("C://barcode-upca-csharp.png"); // other barcode outputting ways // output generated barcode to byte array byte[] barcodeInBytes = barcode.drawBarcodeAsBytes(); // output generated barcode to Graphics object Graphics graphics = ...; barcode.drawBarcode(graphics); // output generated barcode to Bitmap object Bitmap barcodeInBitmap = barcode.drawBarcode(); // draw created barcode to HttpResponse object HttpResponse response = ...; barcode.drawBarcode(response); // save generated barcode image to Stream object Stream stream = ...; barcode.drawBarcode(stream);
Generate Other Linear & 2D Barcode Images in C#.NET Project