Koka
asked on
Print contents of JEditorPane
I have a simle HTML displayed in JEditorPane
and I need to print it.
So, what/how I have to implement?
I hope something like
PrinterJob printJob = PrinterJob.getPrinterJob() ;
printJob.setPrintable(this ); // 'this' is the
//instance of JEditorPane
could do the trick if I correctly implement print (or paint?).
TYA
and I need to print it.
So, what/how I have to implement?
I hope something like
PrinterJob printJob = PrinterJob.getPrinterJob()
printJob.setPrintable(this
//instance of JEditorPane
could do the trick if I correctly implement print (or paint?).
TYA
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hmm, just found ugly feature - for multypage documents there is a chance that upper part of row is printed on one page and the lower one on the next. I should have expected that, should I? Indeed we print text as graphics, so there are just pixels, not letters that can not be printed upper-lower parts separately :(.
So seems I should either do some calculations to fit rows in pages (oh no!), or revert to ugly platform-dependent solution of opening browser in place of JEditorPane.
Or did I miss something?
So seems I should either do some calculations to fit rows in pages (oh no!), or revert to ugly platform-dependent solution of opening browser in place of JEditorPane.
Or did I miss something?
ASKER