Reading status from Zebra Printer
Posted
by pmoreira
on Stack Overflow
See other posts from Stack Overflow
or by pmoreira
Published on 2009-12-04T11:18:10Z
Indexed on
2010/03/31
1:13 UTC
Read the original article
Hit count: 656
Hi,
I'm working on a project where we need to use a Zebra Printer for barcode labels. We're using C#, and we're doing OK on the printing side of things, sending raw ZPL strings to the printer (using winspool.drv).
However, we also need to read from the printer, and no luck there.
We need to get the status from the printer, which is the output to the ZPL command "~HS", so we can tell how many labels are in memory waiting to be printed. The EnumJobs() from winspool.drv only has jobs on the windows spool, and once they're sent to the printer, they're gone from that list. But that doesn't mean the label has been printed, since the printer has a peel sensor and only prints one label at a time, and we're obviously interested in sending batches of labels to the printer.
I've tried something like (using the winspool.drv calls):
OpenPrinter(szPrinterName, out hPrinter, IntPtr.Zero);
WritePrinter(hPrinter, pBytes, dwCount, out dwWritten); // send the string "~HS"
ReadPrinter(hPrinter, data, buff, out pcRead);
But I get nothing on the ReadPrinter call. I don't even know if this is the right way of going at it.
Anyone out there tackled this before?
Thanks.
© Stack Overflow or respective owner