Search code examples
javanetwork-programmingprintingpostscript

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


Solution

  • 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.)