oraj
oraj

Reputation: 23

Print a rendered web page in a printer using java applet

How to print a rendered web page in a printer using customized print dialog (remove page header, footer, set margins etc) with java applet? Can't use window.print() since i need to customize page settings before printing.The web page that needs to be printed is well structured for printing using html and css.

Upvotes: 1

Views: 1537

Answers (1)

Shivan Dragon
Shivan Dragon

Reputation: 15229

Well, a somewhat general answer to your question is to use a Swing component that can render HTML, such as JEditorPane as described here: Render html in Swing application

To actually print the content of a Swing component, you can use Swings OS-agnostic PrinterJob tool, as described here:

http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html

Upvotes: 1

Related Questions