Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Print Multi page JEditorPane html contents in Java

 
Kevin Dsouza
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic