VB.NET UPC-A Generator Size Setting Tutorial
sample source code to generate linear UPC-A images and adjust barcode size in VB.NET
- Complete VB.NET developer tool for UPC-A barcode image generation
- Quick and easy to integrate in VB.NET development environments
- Supported image formats include Gif, Tiff, BMP, PNG, and Jpeg
- Calculate the check digit in UPC-A automatically
- Generate UPC-A supplement barcode
- Set the height of supplement bars based on the height of bars in main barcode
- Easy to set the space between main barcode and supplement barcode
- Conform GS1 Specification
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.
UPC-A Symbology Structure
W: the width of UPC-A barcode image, including quiet zones, controlled by property BarCodeWidth
X (X ≥ 1 pixel): the width of UPC-A module bar , controlled by property X
C: the number of UPC-A encoded data characters, including the check digit; C =12
Q (Q ≥ 10X): the width of the quiet zone, related to property LeftMargin & RightMargin
More information about UPC-A barcode settings in Excel Barcode Generator,please see:
UPC-A VB.NET Generator Size Setting Tutorial
After UPC-A VB.NET Generator installation, get it ready in VB.NET by placing the following statement:
Dim upca As OnBarcode.Barcode.Linear
upca = New OnBarcode.Barcode.Linear
upca.Type = OnBarcode.Barcode.BarcodeType.UPCA
If supplement barcode is needed, please select UPCA_2 or UPCA_5 instead of UPCA. Please remember to add string value to property SupData.
SupHeight & SupSpace
The height of the supplement barcode is controlled by property SupHeight (Type: Float; Default: 0.8).The space between the main barcode and the supplement barcode is set by property SupSpace (Float; Default: 15 pixels).
upca.SupHeight = 0.7
upca.SupSpace = 10
UOM is the controller of size setting unit. Pixel, Cm, and Inch are provided as its options. The default value of UOM is Pixel. For example, type the following statement to select Pixel as the unit of size setting measure:
upca.UOM = OnBarcode.Barcode.UnitOfMeasure.PIXEL
X & Y
Property X (Type: Float; Default: 1) and Property Y (Type: Float; Default: 60) are used in UPC-A barcode symbol size setting. X is for the module width setting (supplement barcode included), and Y controls the height of the bar.
upca.X = 2
upca.Y = 70
BarCodeHeight & BarCodeWidth
Property BarCodeHeight (Type: Float; Default: 0) and Property BarCodeWidth (Type: Float; Default: 0) to set the size of the whole image.
upca.BarcodeHeight = 60
upca.BarcodeWidth = 175
When the value of X, Y, BarCodeWidth, and BarCodeHeight conflict with each other, Property AutoResize (Type: bool; Default: False) should be enabled to solve the problem and make the UPC-A 100% compatible with its symbology specification. See UPC-A Barcode Size in VB.NET to know more usage of AutoResize.
upca.X = 2
upca.BarcodeHeight = 60
upca.AutoResize = True
TopMargin, BottomMargin, LeftMargin, & RightMargin
Using UPC-A VB.NET Generator, a quiet zone with 10X width will be generated automatically at each side of the UPC-A. When wider quiet zone is needed, you can increase the value of properties LeftMargin (Type: Float; Default: 0) and RightMargin (Type: Float; Default: 0). You can also create margins using TopMargin (Type: Float; Default: 0) and BottomMargin (Type: Float; Default: 0).
upca.TopMargin = 10
upca.BottomMargin = 10
upca.LeftMargin = 10
upca.RightMargin = 10
Human readable text are required in almost every linear barcode symbology. Property TextMargin (Type: Float; Default: 6 pixel) is used to set the space between UPC-A bar code and the human readable text below the barcode.
upca.TextMargin = 10