java/grails中的服务器端网络打印
我是 java/grails 开发人员,致力于重新设计软件系统.
I am java / grails developer working on redesigning a software system.
其中一个要求是让服务器端应用程序将数据发送到各种网络打印机以打印文本数据.
One of the requirements is to have a sever-side application send data to various network printers to print text data.
我在网上搜索了有关 java 网络打印的信息,结果很短我查看了 Java Print Service API、java.awt.print、javax.print 并没有发现任何关于连接到网络打印机的信息.
I searched the web for info on java network printing, and came up short I looked into Java Print Service API, java.awt.print, javax.print and did not find anything on connecting to network printers.
我正在尝试做的事情是可能的还是有利的.由于缺乏调查结果,我相信服务器端软件不会直接与网络打印机交互.
Is what I am trying to do possible or favorable. The lack of findings leads me to believe that sever-side software does not interact with network printers directly.
如果可以的话,请指点我一些资源.
If it can be done, please point me to some resources.
推荐答案
网络打印机的处理方式通常与本地连接的打印机没有区别;它们首先在操作系统中设置,这使得它们可用于 Java 打印服务.
Network printers are typically treated no differently from locally connected printers; they are set up in the OS first and this makes them available to the Java Print Service.
如果您需要直接打印到 POS 打印机,它们通常有自己的二进制协议,您可以通过 TCP/UDP 使用该协议.例如,爱普生有 ESC/POS 系统.
If you need to print directly to a POS printer, they usually have their own binary protocol that you can use over TCP/UDP. Epson has the ESC/POS system, for example.
根据打印服务器的不同,您可以通过 CUPS/LRP/LPD/IPP 将 PostScript 直接发送到打印机.请参阅 http://www.cups4j.org 和 http://lpdspooler.sourceforge.net.
Depending on the print server, you may be able to send PostScript straight to the printer via CUPS/LRP/LPD/IPP. See http://www.cups4j.org and http://lpdspooler.sourceforge.net.
相关文章