Sending ZPL on USB

Hi,

 

Our ZM400 is connected to the PC using the USB port. I am looking for a way to send ZPL commands from an C++ application to the printer for printing labels.

 

In this thread (How to Print ZPL or CPCL codes directly vis USB), WinSpool is recommended (OpenPrinter, StartDocPrinter, StartPagePrinter, etc), but I am not sure how they can be used to send raw ZPL commands.

 

We highly prefer to use ZPL instead of generating the images for printing by regular windows API as our application is capable of generating ZPL command for our different various label templates.

 

 

Bests,

Isaac

Anonymous (not verified)
Hi Isaac, There are a few

Hi Isaac, There are a few options:

1. Use the spooler and Win32 API's directly (this may be easiest option)  https://support.microsoft.com/en-us/help/138594/howto-send-raw-data-to-a-printer-by-using-the-win32-api

2. Set up a print driver as a raw driver (qz | Wiki - Setting Up A Raw Printer in Windows ) Not recommended as it's not only slow but needlessly complicated to write the code as if it's a Windows graphic when working with raw data.

3. Open a filestream to the USB HID port directly.  This bypasses the Windows spooler entirely.  I don't have any sample code in C++, but this article gives you an idea of what's involved.  https://antiduh.com/blog/node/9  Given the interfaces, it might be easier in C++.  This can be quite useful and is faster raw printing than using the spooler, but more complicated.  The other major benefit of it is it gives you true 2-way communication so you can query status and set up the printer however you want.  If you decide you want to go this route, I can share the VID's Zebra owns.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Isaac Nickaein
Hi Robin,Thanks for the

Hi Robin,

Thanks for the thorough explanation!

I tried the first solution as you recommended and it was successful.

We currently doesn't have any bi-directional communication requirement but if anything came up, I will look more into the third solution.

Cheers,

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jim Crocco
Hi Linda,I am looking at your

Hi Linda,

I am looking at your Solution #3.  Do you have the VID and PID for a ZE500 print engine?

Thanks!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments