如何通过应用程序向 Zebra 打印机发送 CPCL 或 ZPL 命令?这些命令类似于 ToolBox 中使用的命令。
例如,我如何将“!U1 getvar “allcv””发送到打印机并获得结果。
我正在使用 Link-OS ios SDK,并且连接和打印到打印机已经没有问题。
如何通过应用程序向 Zebra 打印机发送 CPCL 或 ZPL 命令?这些命令类似于 ToolBox 中使用的命令。
例如,我如何将“!U1 getvar “allcv””发送到打印机并获得结果。
我正在使用 Link-OS ios SDK,并且连接和打印到打印机已经没有问题。
Did you ever figure this out? It's quite simple in the *nix world. If you send commands to the lp port via cat
or some such, the printer will simply read them in. Note that this must be done as root if you don't have permissions set up on the device to allow normal users.
$ sudo cat command_file.txt > /dev/usb/lp0
So, I'm not a C or C++ developer, but the idea is the same in any language. Open the file for writing (probably O_RDWR
so you can read back in any response from the printer) and then send commands to the fd returned from open().
You didn't specify an OS so I'll just stick with this *nix answer. That said, it wouldn't be different in Windows, I suppose. You just have to be able to find the right device.