This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Printing a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Printing a file" Watch "Printing a file" New topic

Printing a file

Gary Kephart

Joined: Jul 29, 2003
Posts: 6
I have a Swing app from which I want the following to happen:
1) User selects a report
2) User selects a printer from a dialog box
3) I create either an HTML String or a temp HTML file
4) I send the above to the selected printer
I took a look at the java.awt.print and javax.print packages, but neither seem to do what I want. The javax.print looks close, but I don't see any place for a user to select a printer. Any ideas?
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

Look at the .printDialog() method of a java.awt.print.PrinterJob. That should be what you are looking for.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link:
subject: Printing a file
It's not a secret anymore!