| Author |
Printing on PC / Network Printer
|
Will Barbee
Ranch Hand
Joined: Oct 01, 2008
Posts: 41
|
|
I have a program which develops a set of weekly schedule data and displays it to the user. I would like to print that same data to the PC printer as a report (once the user clicked an appropriate button). Is there an example anywhere that shows how to set up the Java necessary to point to the PC printer and then send the data to it as String data or whatever? I would have to manage headings and footings but that is a program part I understand. Thanks.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
I don't know; the only printing on paper I have ever seen has been in GUIs: try here in the Java Tutorials.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
With AWT's version of printing, it should be possible. The only problem is that you can't call printDialog() which sets up the properties. You will have to do that manually. You could try to use printDialog() in a test class to see what you need to setup manually. I know the PrintService is one of them. You can get the printer (PrintService) using PrinterJob.lookupPrintServices() or some of the methods in javax.print.PrintServiceLookup.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Will Barbee
Ranch Hand
Joined: Oct 01, 2008
Posts: 41
|
|
Thanks for your responses. With the tutorial and the hint, I should be OK.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
And should you run into more problems, this thread will be here
|
 |
 |
|
|
subject: Printing on PC / Network Printer
|
|
|