riaancornelius
asked on
Printing HTML file to a selected printer
I am displaying a (generated) HTML file. Basically it's an overview of all the info a user entered in a wizard. So there is no physical HTML file, only a String which I display as HTML in a JEditorPane.
How do I let the user select a printer and then print this file to that printer? Also, the HTML contains a table with a width of 100% how do I make sure that the HTML prints correctly on any size paper?
Thanks
How do I let the user select a printer and then print this file to that printer? Also, the HTML contains a table with a width of 100% how do I make sure that the HTML prints correctly on any size paper?
Thanks
Have a look here: http://java.sun.com/docs/books/tutorial/2d/printing/index.html
ASKER
that's printing using java.awt.printing. As far as I can see, that will only print to the default printer. I need to know how to print an HTML formatted string to the user specified printer.
I've seen how to use javax.print to select a printer, So I just need to know how to print HTML formatted text using javax.print
I've seen how to use javax.print to select a printer, So I just need to know how to print HTML formatted text using javax.print
> As far as I can see, that will only print to the default printer
It will print to the printer you have previously selected.
It will print to the printer you have previously selected.
ASKER
>> It will print to the printer you have previously selected.
And how do you select a printer?
And how do you select a printer?
Using a PrinterJob you will get a dialog with the available printers. Then you select the printer you want from there.
Also have a look here: http://javaalmanac.com/egs/javax.print/pkg.html
ASKER
Actually, It seems the simple answer is that it can't be done natively. The longer answer is that HTML can be printed like this:
http://forum.java.sun.com/thread.jspa?forumID=20&threadID=215404
http://forum.java.sun.com/thread.jspa?forumID=20&threadID=215404
ASKER
Requesting that question be deleted...
I would suggest PAQ and points refudned.
ASKER
Agreed. Didn't think about the fact that there is actually a solution in here. :)
I am fine with this :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER