How to print GS1 DataBar RSS 14 barcodes with Zebra ZPL printers and VB.NET or C# by using ThermalLabel SDK for .NET

Prerequisites
– Neodynamic ThermalLabel SDK for .NET
– Microsoft .NET Framework 2.0 (or greater)
– Microsoft Visual Studio 2005 / 2008
– Microsoft Visual Studio 2005 / 2008 Express Editions (VB, C#, J#, and C++)
– Any Zebra Thermal Printer supporting ZPL (Zebra Programming Language)

All Zebra (ZPL-based) thermal barcode printers provide built-in support for printing GS1 DataBar barcode family (formerly RSS – Reduced Space Symbology) as well as other barcode standards

GS1 DataBar is a family of linear barcode symbologies used within the GS1 System.
– GS1 DataBar-14 encodes AI (01) in a linear symbol that can be scanned omnidirectionally by suitably programmed slot scanners.
– GS1 DataBar Limited (formerly RSS Limited) encodes AI (01) in a linear symbol for use on small items that will not be scanned in an omnidirectional scanning environment.
– GS1 DataBar Expanded (formerly RSS Expanded) encodes GS1 System primary item identification plus supplementary AI Element Strings, such as weight and “best before” date, in a linear symbol that can be scanned omnidirectionally by suitably programmed slot scanners.
– GS1 DataBar-14 Stacked is a variation of the GS1 DataBar-14 Symbology that is stacked in two rows and used when the normal symbol would be too wide for the application. It comes in two versions: a truncated version used for small item marking applications and a taller version that is designed to be read by omnidirectional scanners.

In this guide you will learn how to print GS1 DataBar barcodes with Zebra ZPL printers by using ThermalLabel SDK for .NET

IMPORTANT: To test the sample code you must have installed a Zebra ZPL thermal printer.

Follow these steps:
1- Download and install latest version of Neodynamic ThermalLabel SDK for .NET
2- Open Visual Studio 2005 /2008 and create a Windows Forms application.
3- Add a reference to Neodynamic.SDK.ThermalLabel.dll assembly.
4- Example of encoding GS1 DataBar Omnidirectional (formerly RSS-14)
The value to encode is (01) 00614141999996. Please note that you must not specify the AI number i.e. 01 nor the checksum i.e. last 6 number to the Code property or in the BarcodeItem constructor.

Add a button control onto the form and paste the following code in the click event handler of the button:

Visual Basic .NET
‘Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 10, 8)

‘Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarOmnidirectional, “0061414199999”)
‘Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3

‘Add items to ThermalLabel object…
tLabel.Items.Add(bc)

‘Create a PrintJob object
Dim pj As New PrintJob()
‘Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
‘Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203
‘Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”
‘Print ThermalLabel object…
pj.Print(tLabel)

Visual C# .NET
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 10, 8);

//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarOmnidirectional, “0061414199999”);
//Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3;

//Add items to ThermalLabel object…
tLabel.Items.Add(bc);

//Create a PrintJob object
PrintJob pj = new PrintJob();
//Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”;
//Print ThermalLabel object…
pj.Print(tLabel);

5- Example of encoding GS1 DataBar Limited (formerly RSS Limited)
The value to encode is (01) 00614141999996. Please note that you must not specify the AI number i.e. 01 nor the checksum i.e. last 6 number to the Code property or in the BarcodeItem constructor.

Add another button control onto the form and paste the following code in the click event handler of the button:

Visual Basic .NET
‘Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 10, 8)

‘Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarLimited, “0061414199999”)
‘Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3

‘Add items to ThermalLabel object…
tLabel.Items.Add(bc)

‘Create a PrintJob object
Dim pj As New PrintJob()
‘Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
‘Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203
‘Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”
‘Print ThermalLabel object…
pj.Print(tLabel)

Visual C# .NET
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 10, 8);

//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarLimited, “0061414199999”);
//Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3;

//Add items to ThermalLabel object…
tLabel.Items.Add(bc);

//Create a PrintJob object
PrintJob pj = new PrintJob();
//Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”;
//Print ThermalLabel object…
pj.Print(tLabel);

6- Example of encoding GS1 DataBar Expanded (formerly RSS Expanded)
The value to encode is (01) 00614141999996. Please note that you must not specify the AI number i.e. 01 nor the checksum i.e. last 6 number to the Code property or in the BarcodeItem constructor.

Add another button control onto the form and paste the following code in the click event handler of the button:

Visual Basic .NET
‘Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 10, 8)

‘Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarExpanded, “0061414199999”)
‘Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3

‘Add items to ThermalLabel object…
tLabel.Items.Add(bc)

‘Create a PrintJob object
Dim pj As New PrintJob()
‘Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
‘Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203
‘Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”
‘Print ThermalLabel object…
pj.Print(tLabel)

Visual C# .NET
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 10, 8);

//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarExpanded, “0061414199999”);
//Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3;

//Add items to ThermalLabel object…
tLabel.Items.Add(bc);

//Create a PrintJob object
PrintJob pj = new PrintJob();
//Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”;
//Print ThermalLabel object…
pj.Print(tLabel);

7- Example of encoding GS1 DataBar Stacked (formerly RSS-14 Stacked)
The value to encode is (01) 00614141999996. Please note that you must not specify the AI number i.e. 01 nor the checksum i.e. last 6 number to the Code property or in the BarcodeItem constructor.

Add another button control onto the form and paste the following code in the click event handler of the button:

Visual Basic .NET
‘Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 10, 8)

‘Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarStacked, “0061414199999”)
‘Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3

‘Add items to ThermalLabel object…
tLabel.Items.Add(bc)

‘Create a PrintJob object
Dim pj As New PrintJob()
‘Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
‘Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203
‘Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”
‘Print ThermalLabel object…
pj.Print(tLabel)

Visual C# .NET
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 10, 8);

//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarStacked, “0061414199999”);
//Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3;

//Add items to ThermalLabel object…
tLabel.Items.Add(bc);

//Create a PrintJob object
PrintJob pj = new PrintJob();
//Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”;
//Print ThermalLabel object…
pj.Print(tLabel);

8- Example of encoding GS1 DataBar Stacked Omnidirectional (formerly RSS-14 Stacked Omnidirectional)
The value to encode is (01) 00614141999996. Please note that you must not specify the AI number i.e. 01 nor the checksum i.e. last 6 number to the Code property or in the BarcodeItem constructor.

Add another button control onto the form and paste the following code in the click event handler of the button:

Visual Basic .NET
‘Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 10, 8)

‘Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarStackedOmnidirectional, “0061414199999”)
‘Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3

‘Add items to ThermalLabel object…
tLabel.Items.Add(bc)

‘Create a PrintJob object
Dim pj As New PrintJob()
‘Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
‘Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203
‘Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”
‘Print ThermalLabel object…
pj.Print(tLabel)

Visual C# .NET
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 10, 8);

//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarStackedOmnidirectional, “0061414199999”);
//Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3;

//Add items to ThermalLabel object…
tLabel.Items.Add(bc);

//Create a PrintJob object
PrintJob pj = new PrintJob();
//Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”;
//Print ThermalLabel object…
pj.Print(tLabel);

9- Example of encoding GS1 DataBar Truncated (formerly RSS-14 Truncated)
The value to encode is (01) 00614141999996. Please note that you must not specify the AI number i.e. 01 nor the checksum i.e. last 6 number to the Code property or in the BarcodeItem constructor.

Add another button control onto the form and paste the following code in the click event handler of the button:

Visual Basic .NET
‘Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 10, 8)

‘Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarTruncated, “0061414199999”)
‘Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3

‘Add items to ThermalLabel object…
tLabel.Items.Add(bc)

‘Create a PrintJob object
Dim pj As New PrintJob()
‘Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
‘Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203
‘Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”
‘Print ThermalLabel object…
pj.Print(tLabel)

Visual C# .NET
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 10, 8);

//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 2, BarcodeSymbology.GS1DataBarTruncated, “0061414199999”);
//Set bars’ width and height magnification factor…
bc.MagnificationFactor = 3;

//Add items to ThermalLabel object…
tLabel.Items.Add(bc);

//Create a PrintJob object
PrintJob pj = new PrintJob();
//Thermal Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Thermal Printer resolution
pj.PrinterSettings.Dpi = 203;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = “Zebra TLP2844-Z”;
//Print ThermalLabel object…
pj.Print(tLabel);

10- Run the sample Windows Forms application and test it.

Links:
This Demo
More Demos
Download ThermalLabel SDK for .NET
More Information about Neodynamic ThermalLabel SDK for .NET

Neodynamic
.NET Components & Controls
http://www.neodynamic.com