C#. UPC-E Generator Data Encoding Tutorial
Sample source code to input valid data and generate linear UPC-E images in C# .NET
C# UPC-E Introduction
UPC-E, also known as Universal Product Code version E, GTIN-12 with lead 0, GS1-12, UCC-12, is the short form representation of a UPC number.
C# UPC-E barcode is one function of .NET barcode generating SDK, which support UPC-E, UPE-E+2 and UPC-E+5 generation in all Visual C#.NET development environment, including C# ASP.NET web application, C# Windows Form software, SQL Server Reporting Service (SSRS) & Crystal Reports for C#.NET projects and C# class.
This article provides a complete demo for UPC-E, UPE-E+2 and UPC-E+5 data encoding in Visual C#.NET class with C#.NET component.
OnBarcode C# Barcode Generator is designed to generate, create UPC-E and other linear & 2d barcodes in Microsoft Word.
Here are some more tutorials for C# UPC-E generation concerning size & image setting.
How to generate, print barcode using .NET, Java sdk library control with example project source code free download:
Encode UPC-E Valid Character in C#.NET
UPC-E valid character set:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Generate UPC-E Barcodes in C#.NET
UPC-E is a numeric-only linear barcodes. The first digit is number system, which indicates the "type" of product. The number system ranges from 0 to 9. The default of C# UPC-E barcode generator is 0, you can change is in "barcode.UPCESystem = X;"( X = 0-9).
Here is a sample code for making UPC-E barcode in C#.NET
Linear barcode = new Linear();
barcode.Type = BarcodeType.UPCE;
barcode.Data = "123456";
barcode.BarcodeWidth = 200;
barcode.UPCESystem = 1;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upce.png");
C# UPC-E supports UPC-E supplements 2-digit and 5-digit barcodes to be generated:
Create UPC-E+2 Barcodes in C#.NET
UPC-E+2 barcode is also known as UPC-E supplement 2-digit barcode. It is a numeric-only linear barcode.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCE_2;
barcode.Data = "123456";
barcode.SupData = "12";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upce_2.png");
Make UPC-E+5 Barcodes in C#.NET
UPC-E+5 is also called UPC-E supplement 5-digit barcode. Like UPC-E+2 barcode, UPC-E+5 barcode is only to encode numeric data.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCE_5;
barcode.Data = "123456";
barcode.SupData = "12345";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upce_5.png");
Modify UPC-E Valid Length in C#.NET
UPC-E is a fixed-length linear barcode symblogy, with 6 digits to be encoded, plus a number system in the beginning and 1 check digit in the end.
Set UPC-E Barcodes in 8-digit length
Arabic numeral can be encoded into 6 digits with a check digit in the end of data sequence.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCE;
barcode.Data = "123456";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upce.png");
Make UPC-E+2 Barcodes in 10-digit length
C# UPC-E barcodes supports 2-digit supplemental data to add on, which should only be used with magazines, newspapers and other such periodicals. So the total length in UPC-E+2 barcodes reaches at 10 digits, 8 of which are UPC-E data; 2of which are supplemental data and 1of which is check digit.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCE_2;
barcode.Data = "123456";
barcode.SupData = "12";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upce_2.png");
Print UPC-E+5 Barcodes in 13-digit length
C# UPC-E barcodes supports 5-digit supplemental data to add on, used on books to indicate a suggested retail price. So the total length in UPC-E+5 barcodes reaches at 13 digits, 8 of which are UPC-E data; 5 of which are supplemental data and 1 of which is check digit.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCE_2;
barcode.Data = "123456";
barcode.SupData = "12345";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upce_5.png");