简体   繁体   English

发送命令到斑马打印机xcode

[英]send command to zebra printer xcode

How would I send a CPCL or ZPL command to a Zebra printer through an app? 如何通过应用程序将CPCL或ZPL命令发送到Zebra打印机? These commands would be similar to ones used in ToolBox. 这些命令将类似于ToolBox中使用的命令。

For example how would I send "! U1 getvar "allcv"" to a printer and get the results. 例如,如何将“!U1 getvar“ allcv””发送到打印机并获得结果。

I am using the Link-OS ios SDK and already have no problems connecting to and printing to the printers. 我正在使用Link-OS ios SDK,并且连接到打印机并进行打印已经没有问题。

Did you ever figure this out? 你有没有解决这个问题? It's quite simple in the *nix world. 在* nix世界中,这非常简单。 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. 如果通过cat或类似方式将命令发送到lp端口,则打印机将简单地读取它们。请注意,如果您没有在设备上设置允许普通用户的权限,则必须以root用户身份执行。

$ 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. 因此,我不是C或C ++开发人员,但是任何语言的想法都是相同的。 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(). 打开文件进行写入(可能是O_RDWR因此您可以从打印机的任何响应中读回),然后将命令发送到open()返回的fd。

You didn't specify an OS so I'll just stick with this *nix answer. 您未指定操作系统,因此我将坚持使用此* nix答案。 That said, it wouldn't be different in Windows, I suppose. 也就是说,我想在Windows中不会有什么不同。 You just have to be able to find the right device. 您只需要能够找到合适的设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM