【发布时间】:2011-10-10 05:24:21
【问题描述】:
我用 Java 开发了一个代码,通过将其内容类型设置为 text / html,我将 HTML 内容嵌入到 JEditorPane 中。
但是,此内容会溢出到第二页,依此类推。我知道 JEditorPane 有一个 print() 方法可以打印 JEditorPane 的内容,我知道 JEditorPane 的 print() 方法可以打印 JEditorPane 的所有内容,甚至可以打印多个页面。
我想要的是上、左、右、下边距应该设置为0。
如果我只是在运行时通过在打印前更改打印设置来将边距设置为 0,那将无法正常工作。
因此,我必须实现 Printable 接口。但是当我使用 Printable 接口时,它只允许打印 JEditorPane 的第一页。
当我大量搜索此解决方案时,我在 Google 上找到了此链接;
但这里的问题是我在 JEditorPane 中使用了 html 内容。我不知道如何将链接中提供的上述解决方案与由 HTML 代码组成的 JEditorPane 集成
【问题讨论】:
标签: java swing printing jeditorpane