xhy_China said:
The printer's IP was stored in DB. When user press print button,
application will
select printer according to userid form db to do printing job on
server side. So
the selected printer may not be added on server machine, but I want to
use this printer
by java program(in silent way). How can I implement this?
Thx!
The only way this could possibly make sense to me is if you have an
Intranet application used within a single corporation and the printers
are all of the same type, connected to the network in the same way.
For example if all the printers were HP LaserJet model P2xxx or 4xxx
connected using JetDirect then you could emit a subset of Postscript to
them, making a TCP connection to port 9100 at the printer's IP-address.
Either the server application would have to construct the Postscript
directly or use a Postscript driver whose output is known to work on all
the models of printer deployed. The driver might be set to print-to-file
so that you can read the output for onward transmission.
Of course you could probably do the same using another PDL such as PCL5
but I happen to like Postscript
If the client is a web browser I'd look into using that to perform the
printing in a more "normal" way. DHTML, AJAX, applets, whatever.