• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

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
0
riaancornelius
Asked:
riaancornelius
  • 7
  • 6
1 Solution
 
riaancorneliusAuthor Commented:
OK, I've found how you can get a print service by using javax.print, So just need to know how I print?
0
 
girionisCommented:
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
riaancorneliusAuthor Commented:
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
0
 
girionisCommented:
> As far as I  can see, that will only print to the default printer

It will print to the printer you have previously selected.
0
 
riaancorneliusAuthor Commented:
>> It will print to the printer you have previously selected.

And how do you select a printer?
0
 
girionisCommented:
Using a PrinterJob you will get a dialog with the available printers. Then you select the printer you want from there.
0
 
girionisCommented:
0
 
riaancorneliusAuthor Commented:
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
0
 
riaancorneliusAuthor Commented:
Requesting that question be deleted...
0
 
girionisCommented:
I would suggest PAQ and points refudned.
0
 
riaancorneliusAuthor Commented:
Agreed. Didn't think about the fact that there is actually a solution in here. :)
0
 
girionisCommented:
I am fine with this :)
0
 
GhostModCommented:
Closed, 500 points refunded.
GhostMod
Community Support Moderator
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now