Barcode Items
A
BarcodeItem – represented by
Neodynamic.SDK.Printing.BarcodeItem class – lets you to generate bar codes (Linear 1D, 2D and Postal standards) that must be drawn on the label.
By using a BarcodeItem object, you can print ALL barcodes supported by your Zebra Thermal Printer as well as other additional standards exclusively provided by ThermalLabel SDK.
NOTE
In EPL-based printers all text on the barcode a.k.a. human readable text is left aligned.
BarcodeItem Examples:
Example #1: The following figure is a sample label featuring a linear (1D) barcode encoding the string "ABC 123" in Code 39 standard/symbology.
NOTE
The following output is from a ZPL printer. Other printers based on different programming languages like EPL will produce different outputs.
The following is the VB.NET and C# codes for printing such barcode label.
NOTE: Please be aware that in the following code we are using Centimeter as the Unit of Measurement.
Visual Basic
'Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 6, 0)
'Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 1, BarcodeSymbology.Code39, "ABC123")
'Set bars' width and height...
bc.BarWidth = 0.04
bc.BarHeight = 2
'Disable checksum...
bc.AddChecksum = false
'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 language
pj.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.ZPL
'Set Thermal Printer name
pj.PrinterSettings.PrinterName = "Zebra TLP2844-Z"
'Print ThermalLabel object...
pj.Print(tLabel)
C#
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 6, 0);
//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 1, BarcodeSymbology.Code39, "ABC123");
//Set bars' width and height...
bc.BarWidth = 0.04;
bc.BarHeight = 2;
//Disable checksum...
bc.AddChecksum = false;
//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 language
pj.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.ZPL;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = "Zebra TLP2844-Z";
//Print ThermalLabel object...
pj.Print(tLabel);
Example #2: The following figure is a sample label featuring a linear (1D) barcode encoding the number 0596001657 in ISBN standard/symbology.
NOTE
The following output is from a ZPL printer. Other printers based on different programming languages like EPL will produce different outputs.
The following is the VB.NET and C# codes for printing such barcode label.
NOTE: Please be aware that in the following code we are using Centimeter as the Unit of Measurement.
Visual Basic
'Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 6, 0)
'Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 1, BarcodeSymbology.Isbn, "0596001657")
'Set bars' width and height...
bc.BarWidth = 0.04
bc.BarHeight = 2
'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 language
pj.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.ZPL
'Set Thermal Printer name
pj.PrinterSettings.PrinterName = "Zebra TLP2844-Z"
'Print ThermalLabel object...
pj.Print(tLabel)
C#
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 6, 0);
//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 1, BarcodeSymbology.Isbn, "0596001657");
//Set bars' width and height...
bc.BarWidth = 0.04;
bc.BarHeight = 2;
//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 language
pj.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.ZPL;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = "Zebra TLP2844-Z";
//Print ThermalLabel object...
pj.Print(tLabel);
Example #3: The following figure is a sample label featuring a 2D barcode encoding the string "Customer: John Doe; Order Id: 12929930" in Data Matrix standard/symbology.
NOTE
The following output is from a ZPL printer. Other printers based on different programming languages like EPL will produce different outputs.
The following is the VB.NET and C# codes for printing such barcode label.
NOTE: Please be aware that in the following code we are using Centimeter as the Unit of Measurement.
Visual Basic
'Define a ThermalLabel object and set unit to cm and label size
Dim tLabel As New ThermalLabel(UnitType.Cm, 6, 0)
'Define a BarcodeItem object
Dim bc As New BarcodeItem(1, 1, BarcodeSymbology.DataMatrix, "Customer: John Doe; Order Id: 12929930")
'Set data matrix module size...
bc.DataMatrixModuleSize = 0.1
'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 language
pj.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.ZPL
'Set Thermal Printer name
pj.PrinterSettings.PrinterName = "Zebra TLP2844-Z"
'Print ThermalLabel object...
pj.Print(tLabel)
C#
//Define a ThermalLabel object and set unit to cm and label size
ThermalLabel tLabel = new ThermalLabel(UnitType.Cm, 6, 4);
//Define a BarcodeItem object
BarcodeItem bc = new BarcodeItem(1, 1, BarcodeSymbology.DataMatrix, "Customer: John Doe; Order Id: 12929930");
//Set data matrix module size...
bc.DataMatrixModuleSize = 0.1;
//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 language
pj.PrinterSettings.ProgrammingLanguage = ProgrammingLanguage.ZPL;
//Set Thermal Printer name
pj.PrinterSettings.PrinterName = "Zebra TLP2844-Z";
//Print ThermalLabel object...
pj.Print(tLabel);