August 15th, 2009, 11:31 AM
How to Select different Printer for different document?
I am writing a web-based system with java. There are some labels and reports printing. Each requires different printers which are connected to the same client computer.
How could I set so that, when I "Print Doc A", document A would print to printer A, and "Print Doc B" button, document B would print to printer B.
The URL for both documents are different. Doc A is on http://www.xyz.com and Doc b is on http://www.abc.com.
info: It is a web-based system used within a lan. So each user use the system with a fixed computer.
August 16th, 2009, 03:43 AM
Re: How to Select different Printer for different document?
You can get an array of the visible printers via PrintServiceLookup. Then you can set the selected printer for the print job:
If the code is running on the server and the printers are strictly local to the client (not visible to the server), I guess you'd have to let the client choose via their browser.
PrintService printServices=PrintServiceLookup.lookupPrintServices(null, null);
... // select print service
If you're not failing every now and again, it's a sign you're not doing anything very innovative...
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!