SaltyDawg
asked on
Print using EPL2 in C#
I am trying to print to a Zebra Thermal Printer TLP 3742 in C Sharp. I am very unfamiliar with EPL2 Command Language. Here is what I have so far:
SerialPort ComPort1 = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
public void SendData()
{
try
{
using (ComPort1)
{
// Open the port for communications
ComPort1.Open();
// Initialize Printer
InitSerialPrinter(ComPort1 );
str = "50,50,0,4,1,1,N,\"5000685 4160000023 B\"";
//ComPort1.Write(str);
// Close the port
ComPort1.Close();
}
}
catch(Exception)
{
MessageBox.Show("No Serial");
}
}
private void InitShippingPrinter(Serial Port m_pPortCom2)
{
SendCommandToPrinter(m_pPo rtCom2, "\nN");
SendCommandToPrinter(m_pPo rtCom2, "D7");
SendCommandToPrinter(m_pPo rtCom2, "S2");
SendCommandToPrinter(m_pPo rtCom2, "ZT");
SendCommandToPrinter(m_pPo rtCom2, "Q1800,36");
SendCommandToPrinter(m_pPo rtCom2, "q1200");
}
I have the manual but still unsure what to do. Could someone view this code and let me know what I'm doing wrong?
SerialPort ComPort1 = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
public void SendData()
{
try
{
using (ComPort1)
{
// Open the port for communications
ComPort1.Open();
// Initialize Printer
InitSerialPrinter(ComPort1
str = "50,50,0,4,1,1,N,\"5000685
//ComPort1.Write(str);
// Close the port
ComPort1.Close();
}
}
catch(Exception)
{
MessageBox.Show("No Serial");
}
}
private void InitShippingPrinter(Serial
{
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
}
I have the manual but still unsure what to do. Could someone view this code and let me know what I'm doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That was exactly it. I had everything correct up to the point where I did not send the command to print.
I added this:
//Command Printer to Print
tPrinter.ComPortData(ComPo rt2, "P1");
and it's working now, Thanks.
I added this:
//Command Printer to Print
tPrinter.ComPortData(ComPo
and it's working now, Thanks.
ASKER
{
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
SendCommandToPrinter(m_pPo
}