Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java printing directly to a Postscript network printer

I've got Postscript code/data (?) in memory (in a Java Tomcat webapp) that I'd like to send directly to a networked PS printer. Is there an easy way (i.e. just popping open a port and sending the text) to print this, bypassing all of the O/S-specific drivers and stuff (and hopefully not even requiring extra jars)? A link to example code showing how to do this?

Thanks, Dave

like image 555
David Jaquay Avatar asked Nov 24 '08 19:11

David Jaquay


People also ask

How do I print directly to a network printer?

Share the printer on the primary PCSelect the Start button, then select Settings > Devices > Printers & scanners. Choose the printer you want to share, then select Manage. Select Printer Properties, then choose the Sharing tab. On the Sharing tab, select Share this printer.

How do I enable Java print?

At the top of the Security tab, check the Enable Java content in the browser box to enable Java. Uncheck to disable.

How does network printing work?

Network printers serve multiple computers connected through a common network. This allows multiple computers to print to a single printer, or for multiple printers to share the workload among several computers. A printer can be connected to a network through wired or wireless connections.


1 Answers

open a TCP socket to the LPR port on the target printer.

send your data; as long as the printer comprehends it, you're cool.

don't forget a Line feed when you're done.

(then close the port.)

like image 176
Tim Williscroft Avatar answered Nov 15 '22 18:11

Tim Williscroft