Question

I need to be able to get the output from a zebra printer when I give it a command. In toolbox I send "! U1 getvar "apl" " and it sends the command to the printer and then writes an output to the console. I've successfully managed to send the command to the printer by converting it to bytes and transferring it. But when I try to read from the printer I get a null stream.

Était-ce utile?

La solution

Zebra offers an SDK to help communicate with their printers. You'll find commands in the iOS SDK such as "sendAndWaitForResponse" on the Connection object, which should do what you want: http://www.zebra.com/us/en/products-services/software/link-os/link-os-sdk.html.

In general, Zebra printers support TCP connections so there's no reason you shouldn't be able to write to the printer and read the response. Perhaps you need to wait briefly after sending the outgoing command before reading the response as network conditions can delay the response. If you include your code, we might be better able to help.

As a final note - make sure you are appending a new line character (0x0A) to the end of your ZPL string. The printers will only recognize SGD commands (! U1 commands) if they are terminated with a new line character!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top