C#. UPC-A Generator Data Encoding Tutorial
sample source code to input valid data and generate linear UPC-A images in C# .NET
- Easy to install, integrate UPC-A generating component in C#.NET development environments
- Comprehensive Visual C# sample code provided
- Support to create UPC-A Supplement Barcode with 2-digit and 5-digit add-on symbol
- Completely developed in Visual C#.NET and compatible with .NET 2.0/3.0/3.5 and advanced version
- Generate UPC-A barcodes compatible with the latest UPC-A specification in GS1 System
- Simple to control UPC-A and supplemental data size, including X,Y dimension, barcode width & height, margin of top, bottom, left and right, etc
- Professional UPC-A generating component and royalty free with the purchase of a Developer License
- Tutorial for UPC-A Image Setting in Visual C#.NET
- Tutorial for UPC-A Data Encoding in Visual C#.NET
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.
How to generate, print barcode using .NET, Java sdk library control with example project source code free download:
UPC-A Structure
UPC-A Image Width Related Settings
W: the width of UPC-A barcode image, including quiet zones. Please see BarCodeWidth.
X: the width of a module bar. Please see X.
Supplement Space: the space between the barcode and the supplement. Please see Supplement Space
C: the number of UPC-A encoded data characters, including the check digit; C = 6.
Q: the width of the quiet zone; Q ≥7X; Q (L) = 9X, Q (R) = 7X Please see Left & Right Margin.
UPC-A Image Height Related Settings
H: the barcode height of UPC-A. Please see BarCodeHeight.
Y: the height of a module bar. Please see Y.
Supplement Height: the height of the bar module. Please see Supplement Height.
Top & Bottom Margin: the height of the top & bottom margin. Please see Top & Bottom Margin.
Text Margin: the space between image bar and text. Please see Text Margin.
Text Font: the font style of human-readable text. Please see Text Font.
Setting UPC-A Barcode Size in C#
C# UPC-A barcode provides a set of barcode size settings to specify you UPC-A barcodes. Please download C# barcode component and install, copy those following code to your Visual Studio:
Linear barcode = new Linear();
barcode.Type = BarcodeType.UPCA;
barcode.Data = "ONBARCODE";
Modify your UPC-A barcodes by setting those following properties:
UOM
UOM is short for Unit of Measure, which is the unit of measure for all size related settings in the library. C# UPC-A barcode provides 3 options: Pixel, Cm, and Inch. The default is Pixel.
barcode.UOM = UnitOfMeasure.PIXEL;
Supplement Space
SupplementSpace is the space between the UPC-A barcodes and supplemental data. The default is 15 (float).
barcode.SupplementSpace = 19;
Supplement Height
SupplementHeight is the height of the supplement data bar module. It is the N percent of Y (module height of UPC-A barcode bar). The default is 0.8f (float).
barcode.SupplementSpace = 0.5f;
Barcode Width & Height
BarcodeWidth is the UPC-A barcode image width. The default in C# UPC-A barcode is 0 (float).
BarcodeHeight is the UPC-A barcode image height. The default in C# UPC-A barcode is 0 (float).
barcode.BarcodeWidth = 0;
barcode.BarcodeHeight = 0;
Notice: if your setting is smaller than the barcode required minimum width and height, the library will automatically reset to barcode minimum width. Or you may enable AutoResize to automatically resize your UPC-A barcode image.
Barcode Margin
BarcodeMargin is the white zone around the UPC-A symbol. C# UPC-A barcode provides 4 options: Left Margin, Right Margin, Top Margin and Bottom Margin. The default of these four margins are 0 (float).
barcode.TopMargin = 3;
barcode.BottomMargin = 3;
barcode.LeftMargin = 1;
barcode.RightMargin = 1;
X & Y
X is the width of barcode bar module (narrow bar). The default in C# UPC-A barcode is 1 (float).
Y is the height of barcode bar module. The default in C# UPC-A barcode is 60 (float).
barcode.X = 2;
barcode.Y = 80;
Text Margin & Font
TextMargin is the space between barcode and barcode data text. The default in C# UPC-A barcode is 6 (float).
TextFont is the font style of human-readable text. The default in C# UPC-A barcode is new Font ("Arial", 9f, FontStyle.Regular).
barcode.TextMargin = 9;
barcode.TextFont = new Font("Arial", 20f, FontStyle.Regular);