When i send a ZPL command to Zebra printer via serial port, it will return a message or not?

StackOverflow https://stackoverflow.com/questions/21642815

  •  08-10-2022
  •  | 
  •  

Question

When I send a ZPL command

^XA^MUd^LH2,0^BY2,,80^FO24,32^BCN,,Y^FDYCBZ140123010^FS^XZ

to Zebra printer, will it return a message or not?

If it does, what message (success or something else) will I get from the return, please give me a example.

On the other hand, I know there is a command ~HS which can get the printer status.

Was it helpful?

Solution

When you send ZPL print commands to a Zebra printer, it generally will not respond. This is the case when a print job succeeds or fails. You will have to explicitly ask the printer for any information. Certain commands return responses, such as ~hi (as you mentioned) or ~hs (page 233 in the ZPL manual listed below). SGD getvar commands also return responses. The following command will return the printer's current status (ZPL manual page 704):

! U1 getvar "device.host_status"

[Notice SGD commands must end with a carriage return / line feed]

The ZPL manual contains a full list of SGD commands: ZPL Manual. Also, you can look into Zebra's SDKs. If you can use something besides serial port, and depending on your printer model, you can then take advantage of Zebra's 'status' parts of the SDK to not have to parse everything yourself: Zebra Legacy SDK, Zebra New SDK

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top