1

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.

oraj
  • 23
  • 5

1 Answers1

1

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

Community
  • 1
  • 1
Shivan Dragon
  • 15,004
  • 9
  • 62
  • 103
  • 1
    Thanks Shivan. I tried with JEditor pane but the rendered content was not that good. So I'm currently trying with JWebBrowser. I've raised another questions regarding issues I'm facing in printing the content of JWebBrowser. Your answer provided a good idea in moving forward. – oraj Sep 03 '12 at 15:20
  • @oraj Did you succeeded ? – bslima Sep 23 '13 at 18:09