Print Multi page JEditorPane html contents in Java
posted 4 years ago
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;