2011-10-10 67 views
3

我已经开发了一个Java代码,其中通过将其内容类型设置为text/html将HTML内容嵌入到JEditorPane中。在Java中打印多页JEditorPane html内容

但是,这个内容溢出到第二页等等。我知道JEditorPane有一个print()方法,可以打印JEditorPane的内容,并且我知道JEditorPane的print()方法可以打印JEditorPane的所有内容,甚至可以打印多个页面。

我想的是,上,左,右,下边距应设置为0。

如果我只想通过更改打印设置留在运行时边距设置为0的工作打印之前,它不会工作。

由于这个原因我不得不实现Printable接口。但是当我使用Printable接口时,它只允许打印JEditorPane的第一页。

当我搜索了很多这个解决方案,我在Google上获得了这个链接;

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

但这里的问题是,我使用的JEditorPane中的HTML内容。我不知道如何在链接设置有由HTML代码

回答