How to Send Pure EPCL Directly to a Zebra Card Printer

Article ID: 03745984

Details


 

Topic or Information

It is possible to send properly formatted EPCL command language to Zebra Performance Class and Value Class Card Printers.  ZXP Series Card printers do not support the EPCL command language

Applies To

Zebra Value Class and Performance Class Card Printers  (P100i, P110i, P110m, P120i, P330i, P430i)

Details

It often becomes advantageous to send printer command language either with a generic driver or directly to a printer instead of relying on the Zebra driver for communication.  On Zebra's Performance and Value class printers, one can send EPCL commands either directly to the printer or via a generic text driver acting as a pass-through.  Here we explain how to properly format EPCL so that the printer can receive it directly through a generic text driver or any other unadulterated means.  You will find download links for the EPCL text file, EPCL USB-ready text file, and EPCL TCP/IP-ready text file at the bottom of this article.
*Note: EPCL is only designed for use on Performance and Value Class Printers.  It is generally advisable to use the Card SDKs as a means of communicating with your card printer from a Windows environment, since they abstract all EPCL and provide intuitive function calls instead.  To obtain a copy of the EPCL manual, see Additional Information at the bottom of this document.  

Card SDK Download Site  Read More>>

1.  Format the EPCL to make it print-ready
We begin by creating a simple EPCL text file in Windows Notepad.  The commands below clear the graphics buffer, draw text to the buffer, and call to print to a monochrome panel.
User-added image
Using a hex editor like Cygnus Hex Editor, open the EPCL text file that was created.
Download Cygnus Hex Editor  Read More>>
User-added image
Modify the file so that each EPCL command starts with an escape character <0x1b> and that every EPCL command ends only with a carriage return <0x0D>.  Get rid of the new line characters <0x0A>.  You can insert new characters (instead of overwriting) by pressing the insert key on the keyboard.  After pressing it, it should say ‘INS’ on the bottom.  

User-added image
For communication over USB, your EPCL file is now ready to be sent directly to the printer.  You can skip to the next step entitled "Send the file through a generic driver".  If you are communicating over TCP/IP, you must append additional data to the stream.  Specifically, each EPCL command must be prefaced with three null characters and a 'length of command' character.  In total, each TCP/IP EPCL command will follow this formula:
<hex 00><hex 00><hex 00><Length of Command><hex 1B><EPCL Byte 1><EPCL Byte 2>...<EPCL Byte X><hex 0D>
In this formula, the 'Length of Command' byte represents the amount of data bits following the 'Length of Command' byte.  As an example, here is the byte composition needed to send the EPCL command A (which prints a test card) to the printer over TCP/IP:
<hex 00><hex 00><hex 00><hex 03><hex 1B><hex 41><hex 0D>
Here is our EPCL file modified to follow the TCP/IP protocol:
User-added image
 
2. Send the file through a generic driver
For the sake of this tutorial, we will assume that you have already installed the Zebra driver and have it configured to print with your printer.  If not, please download and install the driver from www.zebra.com/drivers.  As part of this tutorial, we will be taking that driver and reconfiguring it to become a generic text driver.
First, we enter Windows Printers and Faxes and right click on our printer, selecting 'Properties'.  Under the 'Sharing' tab, we indicate that we want to share our printer, and we assign it a shared name. 
 User-added image
Next we change the driver in use from the Zebra driver to a generic text driver.  This is done under the 'advanced' tab.
User-added image
Finally, we issue the Windows command prompt command to send our EPCL file to the printer.  The command follows this pattern:
copy filename \\computer-name\shared-printer-name
 User-added image
If unsure, you can find your computer name by right clicking on my computer > Properties > Computer Name.

Additional Information

EPCL Programmers Manual  Read More>>