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");









OnBarcode is a market-leading provider of barcode imaging generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides comprehensive tutorials and how-tos for various linear, 2d barcode information, such as C# in ASP.NET, C# .NET, C# Barcode Encoding, C# Barcode Image, VB.NET in ASP.NET, VB.NET Winforms, VB.NET Barcode Encoding. OnBarcode barcode products are supported by RasterEdge ASP.NET Document Viewer, which supports ASP.NET PDF Viewer, ASP.NET MVC Document Viewer, ASP.NET PDF Editor, MVC PDF Viewer. And provide high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.