aspose file tools*
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
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: 1817

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.
It is sorta covered in the JavaRanch Style Guide.
subject: Printing a file