VB.NET Code 2 of 5 Generator Size Setting Tutorial
sample source code to generate linear Code 2 of 5 images and adjust barcode size in VB.NET
- Easy to be installed in VB.NET IDEs
- Reusable .NET component
- Easy to set the width of wide bars and narrow bars
- Supported unit of measure include Pixel, Cm, and Inch
- Print flexible margins around Code 2 of 5 Symbol
- Support symbol and background color setting
- Generate Code 2 of 5 in GIF, TIFF, BMP, PNG, and JPEG
Code 2 of 5, also known as Standard 2 of 5, Industrial 2 of 5, is a low-density numeric symbology that has been widely used in warehouse, photo finishing and airline industries.
How to generate, print barcode using .NET, Java sdk library control with example project source code free download:
Code 2 of 5 Symbology Structure
W: the width of Code 2 of 5, controlled by property BarCodeWidth
X (X ≥ 1 pixel): the width of a module bar, controlled by property X
Q (Q ≥ 10X): the width of the quiet zone, related to property LeftMargin & RightMargin
More information about Code 2 of 5 barcode settings in VB.NET Barcode Generator,please see:
Code 2 of 5 VB.NET Generator Size Setting Tutorial
After Code 2 of 5 VB.NET Generator installation, get it ready in VB.NET by placing the following statement:
Dim code2of5 As OnBarcode.Barcode.Linear
code2of5 = New OnBarcode.Barcode.Linear
code2of5.Type = OnBarcode.Barcode.BarcodeType.CODE2OF5
UOM
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:
code2of5.UOM = OnBarcode.Barcode.UnitOfMeasure.PIXEL
X & Y
Property X (Type: Float; Default: 1) and Property Y (Type: Float; Default: 60) are used in Code 2 of 5 barcode symbol size setting. X is for the module width setting, and Y controls the height of the bar.
Sample usage:
code2of5.X = 2
code2of5.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.
Sample usage:
code2of5.BarcodeHeight = 60
code2of5.BarcodeWidth = 175
AutoResize
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 Code 2 of 5 100% compatible with its symbology specification. See Code 2 of 5 Barcode Size in VB.NET to know more usage of AutoResize.
Sample usage:
code2of5.X = 2
code2of5.BarcodeHeight = 60
code2of5.AutoResize = True
TopMargin, BottomMargin, LeftMargin, & RightMargin
Using Code 2 of 5 VB.NET Generator, a quiet zone with 10X width will be generated automatically at each side of the Code 2 of 5. 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).
Sample usage:
code2of5.TopMargin = 10
code2of5.BottomMargin = 10
code2of5.LeftMargin = 10
code2of5.RightMargin = 10
TextMargin
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 Code 2 of 5 bar code and the human readable text below the barcode.
Sample usage:
code2of5.TextMargin = 10