C#. UPC-A Generator Data Encoding Tutorial
Sample source code to input valid data and generate linear UPC-A images in C# .NET
C# UPC-A Introduction
UPC-A, also known as Universal Product Code version A , UPC Code, UPC Symbol, GTIN-12, GS1-12, UCC-12, is the most common and well-known barcode symbology in the United States.
C# UPC-A barcode is an easy-to-use barcode generating component, which may easily install & integrate barcode UPC-A generation library SDK into C# developments. It is compatible with GS1 system standard of UPC-A generation. Moreover, UPC-A+2 and UPC-A+5 barcodes are also supported by this product.
This page explains how to encode UPC-A, UPC-A+2 and UPC-A+5 barcodes in .NET programs using C#.NET barcode generating SDK.
OnBarcode C# Barcode Generator is designed to generate, create UPC-A and other linear & 2d barcodes in Microsoft Word.
Here are some more tutorials for C# UPC-A generation concerning size & image setting.
Encode UPC-A Valid Character in C#.NET
UPC-A valid character set:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
How to generate, print barcode using .NET, Java sdk library control with example project source code free download:
Generate UPC-A Barcodes in C#.NET
UPC-A is a numeric-only linear barcodes. The first digit is number system, which indicates the "type" of product.
0 - normal UPC Code
1 - reserved
2 - Reserved for local use (store/warehouse), for items sold by variable weight
3 - National Drug Code (NDC) and National Health Related Items Code (HRI)
4 - Reserved for local use (store/warehouse), often for loyalty cards or store coupons
5 - coupon
6 - reserved
7 - normal UPC Code
8 - reserved
9 - reserved
Here is a sample code for making UPC-A barcode in C#.NET
Linear barcode = new Linear();
barcode.Type = BarcodeType.UPCA;
barcode.Data = "12345678901";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upca.png");
C# UPC-A supports UPC-A supplements 2-digit and 5-digit barcodes to be generated:
Create UPC-A+2 Barcodes in C#.NET
UPC-A+2 barcode is also known as UPC-A supplement 2-digit barcode. It is a numeric-only linear barcode.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCA_2;
barcode.Data = "12345678901";
barcode.SupData = "12";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upca_2.png");
Make UPC-A+5 Barcodes in C#.NET
UPC-A+5 is also called UPC-A supplement 5-digit barcode. Like UPC-A+2 barcode, UPC-A+5 barcode is only to encode numeric data.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCA_5;
barcode.Data = "12345678901";
barcode.SupData = "12345";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upca_5.png");
Modify UPC-A Valid Length in C#.NET
UPC-A is a fixed-length linear barcode symblogy, with 12 digits to be encoded and plus 1 check digit.
Set UPC-A Barcodes in 13-digit length
Arabic numeral can be encoded into 12 digits with a check digit in the end of data sequence.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCA;
barcode.Data = "12345678901";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upca.png");
Make UPC-A+2 Barcodes in 15-digit length
C# UPC-A 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-A+2 barcodes reaches at 15 digits, 12 of which are UPC-A data; 2of which are supplemental data and 1of which is check digit.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCA_2;
barcode.Data = "12345678901";
barcode.SupData = "12";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upca_2.png");
Print UPC-A+5 Barcodes in 18-digit length
C# UPC-A barcodes supports 5-digit supplemental data to add on, used on books to indicate a suggested retail price. So the total length in UPC-A+5 barcodes reaches at 18 digits, 12 of which are UPC-A data; 5 of which are supplemental data and 1of which is check digit.
Linear barcode = new Li0near();
barcode.Type = BarcodeType.UPCA_2;
barcode.Data = "12345678901";
barcode.SupData = "12345";
barcode.BarcodeWidth = 200;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/upca_5.png");