问题
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.
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.
回答1:
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.
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.
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.
来源:https://stackoverflow.com/questions/7368272/server-side-network-printing-in-java-grails