aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Print Multi page JEditorPane html contents in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Print Multi page JEditorPane html contents in Java" Watch "Print Multi page JEditorPane html contents in Java" New topic
Author

Print Multi page JEditorPane html contents in Java

Kevin Dsouza
Greenhorn

Joined: Jun 02, 2011
Posts: 1
down vote favorite
share [fb] share [tw]


I have developed a code in Java where I have embedded HTML content into a JEditorPane by setting its content type to text / html.

However this content spills over to the second page and so on. I know that the JEditorPane has a print() method that prints the contents of the JEditorPane and I know that the print() method of the JEditorPane prints all the contents of the JEditorPane and even prints multiple pages.

What I want is that the top, left, right and bottom margins should be set to 0.

If I would simply leave the work of setting the margins to 0 at run-time by changing the print settings before printing, it would just not work.

Due to this I had to implement the Printable interface. But when I used the Printable interface it allows to print only the first page of the JEditorPane.

When I searched a lot for this solution I got this link on Google;

http://download.oracle.com/javase/tutorial/displayCode.html?code=http://download.oracle.com/javase/tutorial/2d/printing/examples/PaginationExample.java

But the problem here is that I am using html contents in the JEditorPane. I dont know how to integrate the above solution provided in the link with a JEditorPane that consists of HTML Code
 
jQuery in Action, 2nd edition
 
subject: Print Multi page JEditorPane html contents in Java