How to set up the thermal label length or height in Zebra ZPL-EPL printers with VB.NE

Neodynamic

Well-known member
Joined
Dec 5, 2005
Messages
137
Programming Experience
10+
How to set up the thermal label length or height in Zebra ZPL-EPL printers with VB.NET or C# by using ThermalLabel SDK for .NET

Prerequisites
- Neodynamic ThermalLabel SDK 2.0 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) or EPL (Eltron Programming Language)

Neodynamic ThermalLabel SDK for .NET features PrintUtils class which lets you to control your Zebra ZPL-based or EPL-based printer by writing just pure .NET code in VB or C#.
When you need to load or change the roll media, you can instruct to the Zebra ZPL-EPL printer to automatically detect the label's length or height by using AutoSetLabelLength method of PrintUtils class.
When using AutoSetLabelLength method, the thermal printer will feed one or more blank labels depending on the size of the label. The following guide is about how to perform auto setting calibration for label's length.

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

Follow these steps:
- Download and install latest version of Neodynamic ThermalLabel SDK for .NET
- Open Visual Studio 2005 /2008 and create a Windows Forms application.
- Add a reference to Neodynamic.SDK.ThermalLabel.dll assembly.
- Add a button control onto the form and paste the following code in the click event handler of the button:
For ZPL-based Printers
Visual Basic .NET
'Set Printer settings for PrintUtils...
PrintUtils.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
'Set Thermal Printer language
PrintUtils.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.ZPL
'Set Thermal Printer name
PrintUtils.PrinterSettings.PrinterName = "Zebra TLP2844-Z"
'Perform auto label length calibration...
PrintUtils.AutoSetLabelLength()

Visual C# .NET
//Set Printer settings for PrintUtils...
PrintUtils.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Thermal Printer language
PrintUtils.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.ZPL;
//Set Thermal Printer name
PrintUtils.PrinterSettings.PrinterName = "Zebra TLP2844-Z";
//Perform auto label length calibration...
PrintUtils.AutoSetLabelLength();

For EPL-based Printers
Visual Basic .NET
'Set Printer settings for PrintUtils...
PrintUtils.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
'Set Thermal Printer language
PrintUtils.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.EPL
'Set Thermal Printer name
PrintUtils.PrinterSettings.PrinterName = "Zebra GK420t"
'Perform auto label length calibration...
PrintUtils.AutoSetLabelLength()

Visual C# .NET
//Set Printer settings for PrintUtils...
PrintUtils.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Thermal Printer language
PrintUtils.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.EPL;
//Set Thermal Printer name
PrintUtils.PrinterSettings.PrinterName = "Zebra GK420t";
//Perform auto label length calibration...
PrintUtils.AutoSetLabelLength();

- Run the sample Windows Forms application and test it. The Thermal Printer should feed one or more blank labels. After that, you can create a ThermalLabel object (specifying 0-zero to Height property) to verify the new label height was correctly set up by the printer.

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


Neodynamic
.NET Components & Controls
Neodynamic
 
Back
Top