-
August 15th, 2009, 11:31 AM
#1
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
#2
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:
Code:
PrintService[] printServices=PrintServiceLookup.lookupPrintServices(null, null);
... // select print service
printJob.setPrintService(selectedPrintService);
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.
If you're not failing every now and again, it's a sign you're not doing anything very innovative...
W. Allen
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|