Printing
The printing classes are deliveried through two different assemblies, one for clients running on Windows and Unix (macOS or Linux) systems.
WindowsPrintJob
The WindowsPrintJob (which is found in the Neodynamic.SDK.ZPLPrinter.WindowsPrinting.dll) is the object that specifies information about how the output rendering from a ZPLPrinter instance is printed, including the printer device settings and communication, number of copies, etc.; from a Windows client app project.
UnixPrintJob
The UnixPrintJob (which is found in the Neodynamic.SDK.ZPLPrinter.UnixPrinting.dll) is the object that specifies information about how the output rendering from a ZPLPrinter instance is printed, including the printer device settings and communication, number of copies, etc.; from a Unix (macOS or Linux) client app project.
Setting the Printer Communication
Printers can be connected by Serial Port (RS-232), Parallel Port (Centronics), USB or IP Ethernet network depending on the printer model. Printer communication is handled by the PrinterCommunication class which must be specified through a WindowsPrintJob or UnixPrintJob object which are found in the Neodynamic.SDK.ZPLPrinter.WindowsPrinting.dll and Neodynamic.SDK.ZPLPrinter.UnixPrinting.dll assemblies respectively.
Important
The Serial Port (RS-232) and Parallel Port (Centronics) communications are not available under Unix (macOS / Linux)
Note
The snipped codes below use WindowsPrintJob but the same applies for UnixPrintJob.
USB
If your printer is connected by USB, then you will have to install/configure a Windows Driver for the printer. The following code is about how to configure printer communication for a printer connected by USB through a WindowsPrintJob object:
Note
These same settings are valid for the PrinterDriver enum option.
VB
'Create a WindowsPrintJob object
Using pj = New WindowsPrintJob()
pj.PrinterSettings = New PrinterSettings()
'Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB
'Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203
'Set Printer name
pj.PrinterSettings.PrinterName = "Zebra TLP2844-Z"
'...
'PRINTING CODE HERE...
'...
End Using
CS
//Create a WindowsPrintJob object
using (WindowsPrintJob pj = new WindowsPrintJob()){
pj.PrinterSettings = new PrinterSettings();
//Printer is connected through USB
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.USB;
//Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203;
//Set Printer name
pj.PrinterSettings.PrinterName = "Zebra TLP2844-Z";
//...
//PRINTING CODE HERE...
//...
}
Parallel Port (Centronics)
If your printer is connected by Parallel Port (Centronic), then you just need to know the parallel port name to specify it in the PrinterCommunication object. The following code is about how to configure printer communication for a printer connected by LPT1 Parallel Port through a WindowsPrintJob object:
VB
'Create a WindowsPrintJob object
Using pj = New WindowsPrintJob()
pj.PrinterSettings = New PrinterSettings()
'Printer is connected through Parallel Port
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Parallel
'Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203
'Set Printer parallel port name
pj.PrinterSettings.ParallelPortName= "LPT1"
'...
'PRINTING CODE HERE...
'...
End Using
CS
//Create a WindowsPrintJob object
using (WindowsPrintJob pj = new WindowsPrintJob()){
pj.PrinterSettings = new PrinterSettings();
//Printer is connected through Parallel Port
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Parallel;
//Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203;
//Set Printer parallel port name
pj.PrinterSettings.ParallelPortName= "LPT1";
//...
//PRINTING CODE HERE...
//...
}
Serial Port (RS-232)
If your printer is connected by Serial Port (RS-232), then you need to know the Printer serial port settings to specify it in the PrinterCommunication object. Please refer to your Printer User Manual and look for the Serial Communication parameters. The following code is about how to configure printer communication for a Zebra printer connected by COM1 Serial Port through a WindowsPrintJob object:
VB
'Create a WindowsPrintJob object
Using pj = New WindowsPrintJob()
pj.PrinterSettings = New PrinterSettings()
'Printer is connected through Serial Port
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Serial
'Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203
'Set Printer serial port settings
pj.PrinterSettings.Communication.SerialPortName = "COM1"
pj.PrinterSettings.Communication.SerialPortBaudRate = 9600
pj.PrinterSettings.Communication.SerialPortDataBits = 8
pj.PrinterSettings.Communication.SerialPortStopBits = SerialPortStopBits.One
pj.PrinterSettings.Communication.SerialPortParity = SerialPortParity.None
pj.PrinterSettings.Communication.SerialPortFlowControl = SerialPortHandshake.XOnXOff
'...
'PRINTING CODE HERE...
'...
End Using
CS
//Create a WindowsPrintJob object
using (WindowsPrintJob pj = new WindowsPrintJob()){
pj.PrinterSettings = new PrinterSettings();
//Printer is connected through Serial Port
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Serial;
//Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203;
//Set Printer serial port settings
pj.PrinterSettings.Communication.SerialPortName = "COM1";
pj.PrinterSettings.Communication.SerialPortBaudRate = 9600;
pj.PrinterSettings.Communication.SerialPortDataBits = 8;
pj.PrinterSettings.Communication.SerialPortStopBits = SerialPortStopBits.One;
pj.PrinterSettings.Communication.SerialPortParity = SerialPortParity.None;
pj.PrinterSettings.Communication.SerialPortFlowControl = SerialPortHandshake.XOnXOff;
//...
//PRINTING CODE HERE...
//...
}
IP Ethernet Network
If your printer is connected by an IP Ethernet network, then you just need to know the IP Address as well as the port number for the printer to specify them in the PrinterCommunication object. The following code is about how to configure printer communication for a printer connected by IP Ethernet through a WindowsPrintJob object:
VB
'Create a WindowsPrintJob object
Using pj = New WindowsPrintJob()
pj.PrinterSettings = New PrinterSettings()
'Printer is connected through IP network
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Network
'Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203
'Set Printer network info
pj.PrinterSettings.Communication.NetworkIPAddress = System.Net.IPAddress.Parse("127.0.0.1")
pj.PrinterSettings.Communication.NetworkPort = 9100
'...
'PRINTING CODE HERE...
'...
End Using
CS
//Create a WindowsPrintJob object
using (WindowsPrintJob pj = new WindowsPrintJob()){
pj.PrinterSettings = new PrinterSettings();
//Printer is connected through IP network
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Network;
//Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203;
//Set Printer network info
pj.PrinterSettings.Communication.NetworkIPAddress = System.Net.IPAddress.Parse("127.0.0.1");
pj.PrinterSettings.Communication.NetworkPort = 9100;
//...
//PRINTING CODE HERE...
//...
}
- In case you do not know which is the IP Address of the printer but the Host name, then you can use the following code instead:
VB
'Create a WindowsPrintJob object
Using pj = New WindowsPrintJob()
pj.PrinterSettings = New PrinterSettings()
'Printer is connected through IP network
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Network
'Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203
'Set Printer network info
pj.PrinterSettings.PrinterName = "PRINTER HOST NAME"
pj.PrinterSettings.Communication.NetworkPort = 9100
'...
'PRINTING CODE HERE...
'...
End Using
CS
//Create a WindowsPrintJob object
using (WindowsPrintJob pj = new WindowsPrintJob()){
pj.PrinterSettings = new PrinterSettings();
//Printer is connected through IP network
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Network;
//Set Printer resolution from the ZPLPrinter instance!
pj.PrinterSettings.Dpi = 203;
//Set Printer network info
pj.PrinterSettings.PrinterName = "PRINTER HOST NAME";
pj.PrinterSettings.Communication.NetworkPort = 9100;
//...
//PRINTING CODE HERE...
//...
}
Printing the output rendering
Raw Commands
Raw commands are considered the following RenderOutputFormat values: GRF, EPL, FP, NV, PCX and PCL.
For Windows clients
This sample will convert the ZPL commands to EPL and then print them.
VB
Imports Neodynamic.SDK.ZPLPrinter
Imports Neodynamic.SDK.ZPLPrinter.Printing
'...
Try
'The ZPL commands to be rendered...
Dim zplCommands As String = "^XA^FO20,30^GB750,1100,4^FS^FO20,30^GB750,200,4^FS^FO20,30^GB750,400,4^FS^FO20,30^GB750,700,4^FS^FO20"& _
",226^GB325,204,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO30,260^ADN,18,10^FDPart number #^FS^FO360,260^"& _
"ADN,18,10^FDDescription:^FS^FO30,750^ADN,36,20^FDFrom:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO6"& _
"0,330^ADN,36,20^FD14042^FS^FO400,330^ADN,36,20^FDScrew^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^FO150,"& _
"800^ADN,36,20^FDMacks Fabricating^FS^XZ"
'Create an instance of ZPLPrinter class
Using myZPLPrinter = New ZPLPrinter("LICENSE OWNER", "LICENSE KEY")
'Set printer DPI
'The DPI value to be set must match the value for which
'the ZPL commands to be processed were created!!!
myZPLPrinter.Dpi = 203
'Apply antialiasing?
myZPLPrinter.AntiAlias = true
'set label size e.g. 4in x 6in
myZPLPrinter.LabelWidth = (4 * myZPLPrinter.Dpi)
myZPLPrinter.LabelHeight = (6 * myZPLPrinter.Dpi)
'Set image or doc format for output rendering
myZPLPrinter.RenderOutputFormat = RenderOutputFormat.EPL
myZPLPrinter.EnablePrinting = True
'Set ZPL commands to be processed...
Dim buffer = myZPLPrinter.ProcessCommands(zplCommands, enc)
'Create a PrintJob
Using pj = New WindowsPrintJob()
'Specify the PrinterSettings
'REFER ABOVE TOPIC!
'pj.PrinterSettings. ...
Try
'Print the output from the ZPLPrinter instance
pj.PrintRawCommands(buffer)
Catch ex1 As Exception
Throw ex1
End Try
End Using
End Using
Catch ex As Exception
Throw ex
End Try
CS
using Neodynamic.SDK.ZPLPrinter;
using Neodynamic.SDK.ZPLPrinter.Printing;
//...
try
{
//The ZPL commands to be rendered...
string zplCommands = "^XA^FO20,30^GB750,1100,4^FS^FO20,30^GB750,200,4^FS^FO20,30^GB750,400,4^FS^FO20,30^GB750,700,4^FS^FO20,226^GB325,204,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO30,260^ADN,18,10^FDPart number #^FS^FO360,260^ADN,18,10^FDDescription:^FS^FO30,750^ADN,36,20^FDFrom:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO60,330^ADN,36,20^FD14042^FS^FO400,330^ADN,36,20^FDScrew^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^FO150,800^ADN,36,20^FDMacks Fabricating^FS^XZ";
//Create an instance of ZPLPrinter class
using (var myZPLPrinter = new ZPLPrinter("LICENSE OWNER", "LICENSE KEY"))
{
//Set printer DPI
//The DPI value to be set must match the value for which
//the ZPL commands to be processed were created!!!
myZPLPrinter.Dpi = 203;
//Apply antialiasing?
myZPLPrinter.AntiAlias = true;
//set label size e.g. 4in x 6in
myZPLPrinter.LabelWidth = 4 * myZPLPrinter.Dpi;
myZPLPrinter.LabelHeight = 6 * myZPLPrinter.Dpi;
//Set image or doc format for output rendering
myZPLPrinter.RenderOutputFormat = RenderOutputFormat.EPL;
myZPLPrinter.EnablePrinting = true;
//Set ZPL commands to be processed...
var buffer = myZPLPrinter.ProcessCommands(zplCommands, enc);
//Create a PrintJob
using (WindowsPrintJob pj = new WindowsPrintJob())
{
//Specify the PrinterSettings
//REFER ABOVE TOPIC!
//pj.PrinterSettings. ...
try
{
//Print the output from the ZPLPrinter instance
pj.PrintRawCommands(buffer);
}
catch(Exception ex1)
{
throw ex1;
}
}
}
}
catch (Exception ex)
{
throw ex;
}
For Unix (macOS or Linux) clients
This sample will convert the ZPL commands to EPL and then print them.
VB
Imports Neodynamic.SDK.ZPLPrinter
Imports Neodynamic.SDK.ZPLPrinter.Printing
'...
Try
'The ZPL commands to be rendered...
Dim zplCommands As String = "^XA^FO20,30^GB750,1100,4^FS^FO20,30^GB750,200,4^FS^FO20,30^GB750,400,4^FS^FO20,30^GB750,700,4^FS^FO20"& _
",226^GB325,204,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO30,260^ADN,18,10^FDPart number #^FS^FO360,260^"& _
"ADN,18,10^FDDescription:^FS^FO30,750^ADN,36,20^FDFrom:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO6"& _
"0,330^ADN,36,20^FD14042^FS^FO400,330^ADN,36,20^FDScrew^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^FO150,"& _
"800^ADN,36,20^FDMacks Fabricating^FS^XZ"
'Create an instance of ZPLPrinter class
Using myZPLPrinter = New ZPLPrinter("LICENSE OWNER", "LICENSE KEY")
'Set printer DPI
'The DPI value to be set must match the value for which
'the ZPL commands to be processed were created!!!
myZPLPrinter.Dpi = 203
'Apply antialiasing?
myZPLPrinter.AntiAlias = true
'set label size e.g. 4in x 6in
myZPLPrinter.LabelWidth = (4 * myZPLPrinter.Dpi)
myZPLPrinter.LabelHeight = (6 * myZPLPrinter.Dpi)
'Set image or doc format for output rendering
myZPLPrinter.RenderOutputFormat = RenderOutputFormat.EPL
myZPLPrinter.EnablePrinting = True
'Set ZPL commands to be processed...
Dim buffer = myZPLPrinter.ProcessCommands(zplCommands, enc)
'Create a PrintJob
Using pj = New UnixPrintJob()
'Specify the PrinterSettings
'REFER ABOVE TOPIC!
'pj.PrinterSettings. ...
Try
'Print the output from the ZPLPrinter instance
pj.PrintRawCommands(buffer)
Catch ex1 As Exception
Throw ex1
End Try
End Using
End Using
Catch ex As Exception
Throw ex
End Try
CS
using Neodynamic.SDK.ZPLPrinter;
using Neodynamic.SDK.ZPLPrinter.Printing;
//...
try
{
//The ZPL commands to be rendered...
string zplCommands = "^XA^FO20,30^GB750,1100,4^FS^FO20,30^GB750,200,4^FS^FO20,30^GB750,400,4^FS^FO20,30^GB750,700,4^FS^FO20,226^GB325,204,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO30,260^ADN,18,10^FDPart number #^FS^FO360,260^ADN,18,10^FDDescription:^FS^FO30,750^ADN,36,20^FDFrom:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO60,330^ADN,36,20^FD14042^FS^FO400,330^ADN,36,20^FDScrew^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^FO150,800^ADN,36,20^FDMacks Fabricating^FS^XZ";
//Create an instance of ZPLPrinter class
using (var myZPLPrinter = new ZPLPrinter("LICENSE OWNER", "LICENSE KEY"))
{
//Set printer DPI
//The DPI value to be set must match the value for which
//the ZPL commands to be processed were created!!!
myZPLPrinter.Dpi = 203;
//Apply antialiasing?
myZPLPrinter.AntiAlias = true;
//set label size e.g. 4in x 6in
myZPLPrinter.LabelWidth = 4 * myZPLPrinter.Dpi;
myZPLPrinter.LabelHeight = 6 * myZPLPrinter.Dpi;
//Set image or doc format for output rendering
myZPLPrinter.RenderOutputFormat = RenderOutputFormat.EPL;
myZPLPrinter.EnablePrinting = true;
//Set ZPL commands to be processed...
var buffer = myZPLPrinter.ProcessCommands(zplCommands, enc);
//Create a PrintJob
using (UnixPrintJob pj = new UnixPrintJob())
{
//Specify the PrinterSettings
//REFER ABOVE TOPIC!
//pj.PrinterSettings. ...
try
{
//Print the output from the ZPLPrinter instance
pj.PrintRawCommands(buffer);
}
catch(Exception ex1)
{
throw ex1;
}
}
}
}
catch (Exception ex)
{
throw ex;
}
Images and PDF
Images and PDF are the following RenderOutputFormat values: PNG, JPG and PDF.
- Images (PNG and JPG) as valid values for printing under Windows
- PDF is valid for printing under Unix (macOS and Linux)
For Windows clients
This sample will convert the ZPL commands to PNG and then print them.
VB
Imports Neodynamic.SDK.ZPLPrinter
Imports Neodynamic.SDK.ZPLPrinter.Printing
'...
Try
'The ZPL commands to be rendered...
Dim zplCommands As String = "^XA^FO20,30^GB750,1100,4^FS^FO20,30^GB750,200,4^FS^FO20,30^GB750,400,4^FS^FO20,30^GB750,700,4^FS^FO20"& _
",226^GB325,204,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO30,260^ADN,18,10^FDPart number #^FS^FO360,260^"& _
"ADN,18,10^FDDescription:^FS^FO30,750^ADN,36,20^FDFrom:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO6"& _
"0,330^ADN,36,20^FD14042^FS^FO400,330^ADN,36,20^FDScrew^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^FO150,"& _
"800^ADN,36,20^FDMacks Fabricating^FS^XZ"
'Create an instance of ZPLPrinter class
Using myZPLPrinter = New ZPLPrinter("LICENSE OWNER", "LICENSE KEY")
'Set printer DPI
'The DPI value to be set must match the value for which
'the ZPL commands to be processed were created!!!
myZPLPrinter.Dpi = 203
'Apply antialiasing?
myZPLPrinter.AntiAlias = true
'set label size e.g. 4in x 6in
myZPLPrinter.LabelWidth = (4 * myZPLPrinter.Dpi)
myZPLPrinter.LabelHeight = (6 * myZPLPrinter.Dpi)
'Set image or doc format for output rendering
myZPLPrinter.RenderOutputFormat = RenderOutputFormat.PNG
'Set ZPL commands to be processed...
Dim buffer = myZPLPrinter.ProcessCommands(zplCommands, enc)
'Create a PrintJob
Using pj = New WindowsPrintJob()
'Specify the PrinterSettings
'REFER ABOVE TOPIC!
'pj.PrinterSettings. ...
' Set the printer dpi/resolution
pj.PrinterSettings.Dpi = myZPLPrinter.Dpi
Try
'Print the output from the ZPLPrinter instance
pj.PrintImage(buffer)
Catch ex1 As Exception
Throw ex1
End Try
End Using
End Using
Catch ex As Exception
Throw ex
End Try
CS
using Neodynamic.SDK.ZPLPrinter;
using Neodynamic.SDK.ZPLPrinter.Printing;
//...
try
{
//The ZPL commands to be rendered...
string zplCommands = "^XA^FO20,30^GB750,1100,4^FS^FO20,30^GB750,200,4^FS^FO20,30^GB750,400,4^FS^FO20,30^GB750,700,4^FS^FO20,226^GB325,204,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO30,260^ADN,18,10^FDPart number #^FS^FO360,260^ADN,18,10^FDDescription:^FS^FO30,750^ADN,36,20^FDFrom:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO60,330^ADN,36,20^FD14042^FS^FO400,330^ADN,36,20^FDScrew^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^FO150,800^ADN,36,20^FDMacks Fabricating^FS^XZ";
//Create an instance of ZPLPrinter class
using (var myZPLPrinter = new ZPLPrinter("LICENSE OWNER", "LICENSE KEY"))
{
//Set printer DPI
//The DPI value to be set must match the value for which
//the ZPL commands to be processed were created!!!
myZPLPrinter.Dpi = 203;
//Apply antialiasing?
myZPLPrinter.AntiAlias = true;
//set label size e.g. 4in x 6in
myZPLPrinter.LabelWidth = 4 * myZPLPrinter.Dpi;
myZPLPrinter.LabelHeight = 6 * myZPLPrinter.Dpi;
//Set image or doc format for output rendering
myZPLPrinter.RenderOutputFormat = RenderOutputFormat.PNG;
//Set ZPL commands to be processed...
var buffer = myZPLPrinter.ProcessCommands(zplCommands, enc);
//Create a PrintJob
using (WindowsPrintJob pj = new WindowsPrintJob())
{
//Specify the PrinterSettings
//REFER ABOVE TOPIC!
//pj.PrinterSettings. ...
// Set the printer dpi/resolution
pj.PrinterSettings.Dpi = myZPLPrinter.Dpi;
try
{
//Print the output from the ZPLPrinter instance
pj.PrintImage(buffer);
}
catch(Exception ex1)
{
throw ex1;
}
}
}
}
catch (Exception ex)
{
throw ex;
}
For Unix (macOS or Linux) clients
This sample will convert the ZPL commands to PDF and then print them.
VB
Imports Neodynamic.SDK.ZPLPrinter
Imports Neodynamic.SDK.ZPLPrinter.Printing
'...
Try
'The ZPL commands to be rendered...
Dim zplCommands As String = "^XA^FO20,30^GB750,1100,4^FS^FO20,30^GB750,200,4^FS^FO20,30^GB750,400,4^FS^FO20,30^GB750,700,4^FS^FO20"& _
",226^GB325,204,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO30,260^ADN,18,10^FDPart number #^FS^FO360,260^"& _
"ADN,18,10^FDDescription:^FS^FO30,750^ADN,36,20^FDFrom:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO6"& _
"0,330^ADN,36,20^FD14042^FS^FO400,330^ADN,36,20^FDScrew^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^FO150,"& _
"800^ADN,36,20^FDMacks Fabricating^FS^XZ"
'Create an instance of ZPLPrinter class
Using myZPLPrinter = New ZPLPrinter("LICENSE OWNER", "LICENSE KEY")
'Set printer DPI
'The DPI value to be set must match the value for which
'the ZPL commands to be processed were created!!!
myZPLPrinter.Dpi = 203
'Apply antialiasing?
myZPLPrinter.AntiAlias = true
'set label size e.g. 4in x 6in
myZPLPrinter.LabelWidth = (4 * myZPLPrinter.Dpi)
myZPLPrinter.LabelHeight = (6 * myZPLPrinter.Dpi)
'Set image or doc format for output rendering
myZPLPrinter.RenderOutputFormat = RenderOutputFormat.PDF
'Set ZPL commands to be processed...
Dim buffer = myZPLPrinter.ProcessCommands(zplCommands, enc)
'Create a PrintJob
Using pj = New UnixPrintJob()
'Specify the PrinterSettings
'REFER ABOVE TOPIC!
'pj.PrinterSettings. ...
Try
'Print the output from the ZPLPrinter instance
pj.PrintPDF(buffer)
Catch ex1 As Exception
Throw ex1
End Try
End Using
End Using
Catch ex As Exception
Throw ex
End Try
CS
using Neodynamic.SDK.ZPLPrinter;
using Neodynamic.SDK.ZPLPrinter.Printing;
//...
try
{
//The ZPL commands to be rendered...
string zplCommands = "^XA^FO20,30^GB750,1100,4^FS^FO20,30^GB750,200,4^FS^FO20,30^GB750,400,4^FS^FO20,30^GB750,700,4^FS^FO20,226^GB325,204,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO30,260^ADN,18,10^FDPart number #^FS^FO360,260^ADN,18,10^FDDescription:^FS^FO30,750^ADN,36,20^FDFrom:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO60,330^ADN,36,20^FD14042^FS^FO400,330^ADN,36,20^FDScrew^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^FO150,800^ADN,36,20^FDMacks Fabricating^FS^XZ";
//Create an instance of ZPLPrinter class
using (var myZPLPrinter = new ZPLPrinter("LICENSE OWNER", "LICENSE KEY"))
{
//Set printer DPI
//The DPI value to be set must match the value for which
//the ZPL commands to be processed were created!!!
myZPLPrinter.Dpi = 203;
//Apply antialiasing?
myZPLPrinter.AntiAlias = true;
//set label size e.g. 4in x 6in
myZPLPrinter.LabelWidth = 4 * myZPLPrinter.Dpi;
myZPLPrinter.LabelHeight = 6 * myZPLPrinter.Dpi;
//Set image or doc format for output rendering
myZPLPrinter.RenderOutputFormat = RenderOutputFormat.PDF;
//Set ZPL commands to be processed...
var buffer = myZPLPrinter.ProcessCommands(zplCommands, enc);
//Create a PrintJob
using (UnixPrintJob pj = new UnixPrintJob())
{
//Specify the PrinterSettings
//REFER ABOVE TOPIC!
//pj.PrinterSettings. ...
try
{
//Print the output from the ZPLPrinter instance
pj.PrintPDF(buffer);
}
catch(Exception ex1)
{
throw ex1;
}
}
}
}
catch (Exception ex)
{
throw ex;
}