VB.NET EAN-13 Generator Data Encoding Tutorial
sample source code to input valid data and generate linear EAN-13 images in VB.NET
EAN-13 VB.NET Generator Setup
EAN-13, also known as European Article Number 13, UPC-13, GTIN-13, GS1-13, EAN/UCC-13, is the standard barcode version of European Article Number.
How to generate, print barcode using .NET, Java sdk library control with example project source code free download:
OnBarcode.com provides more details about how to set EAN-13 barcode size and image in Barcode Generator Control on VB.NET:
Codabar VB.NET Generator installation
1. Download the trial package and unzip
2. Copy OnBarcode.Barcode.WinForms.dll to your .NET project folder
3. Do not copy dll to .NET bin directory, .NET build tools will do it for you.
4. Add OnBarcode.Barcode.WinForms.dll to .NET project reference
5. Right click .NET Visual Studio Toolbox, select menu Choose Items...
6. In "Choose Toolbox Items" form, click button "Browse...", and select OnBarcode.Barcode.WinForms.dll
7. After selection, you will find four items under "Components" section: LinearWinForm, DataMatrixWinForm, PDF417WinForm, and QRCodeWinForm
After, get it ready in VB.NET by placing the following statement where EAN-13 VB.NET Generator is needed:
Dim ean13 As OnBarcode.Barcode.Linear
ean13 = New OnBarcode.Barcode.Linear
ean13.Type = OnBarcode.Barcode.BarcodeType.EAN13
Valid length for Data in EAN-13 VB.NET Generator
EAN-13 Data Length
EAN-13 is a fixed length barcode symbology. There are 13 digits of numeric characters in an EAN-13. The last digit of them is the prerequisite check digit.
Digits in EAN-13 VB.NET Generator
EAN-13 VB.NET Generator will automatically generate and calculate the check digit in EAN-13 basing on the string value you give to property Data. That is to say, using EAN-13 VB.NET Generator, you only have to place 12 digits of numeric characters in the string value of Data.
For example, if "123456789012" is to be encoded, there will be 13 digits on the image ("1234567890128"), the last digit ("8") is the check digit EAN-13 VB.NET Generator automatically generates and calculates for you.
Sample usage:
Dim ean13 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear
ean13.Type = OnBarcode.Barcode.BarcodeType.EAN13
ean13.Data = "123456789012"
Sample image:
Data Character Set for EAN-13 VB.NET Generator
Encode Numeric Character in EAN-13 barcode image
The characters in EAN-13 are numeric. Only numbers 0 through 9 are valid for EAN-13. The data encoded in the EAN-13 in your VB.NET project is defined by property Data. The value of Data is string value.
Sample usage:
ean13.Data = "123456789012"
Draw 2-digit add-on symbol in the image
According to its symbology specification and GS1 specification, a 2-digit add-on symbol could be used in EAN-13 beside its main barcode to supplement the data. When 2-digit add-on is needed, the type should be changed from EAN13 to EAN13_2. Besides, supplement data should be given to property SupData, shown in following Sample usage.
Sample usage:
Dim ean13 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear
ean13.Type = OnBarcode.Barcode.BarcodeType.EAN13_2
ean13.Data = "123456789012"
ean13.SupData = "12"
Sample image:
Encode 5 digits in EAN-13 Add-on
Similarly, 5-digit add-on symbol could be used in EAN-13 where 2-digit add-on could be placed to encode more supplement data.
Sample usage:
Dim ean13 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear
ean13.Type = OnBarcode.Barcode.BarcodeType.EAN13_5
ean13.Data = "123456789012"
ean13.SupData = "12345"
Sample image: