Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在收据打印机上打印一个十六进制文件。对于测试,我使用带有命令的 cmd:“copy /b test.hex lpt3:”
现在我想要一个 java 程序,它可以将 test.hex 发送到打印机,但不能作为图形发送。
请,有人可以告诉我,我该怎么做?
提前致谢
我不再确定字符串中的语法,但您可以随时查看。原则上你可以这样做:
Runtime.getRuntime().exec("cmd /c start copy /b test.hex lpt3:");
这里是参考!
因此,如果您找不到直接从 java 访问该自定义打印机的方法,您可以首先创建该 .hex 文件,然后使用 exec() 发送它。