简体   繁体   English

水平滚动条的 JEditor 窗格打印问题

[英]JEditor pane printing issue with Horizontal scroll bar

We use Jeditor pane for displaying HTML text, but when we try to print with horizontal scroll bar on editor pane the right edge of the page is cut off, Did any experience it?我们使用 Jeditor 窗格来显示 HTML 文本,但是当我们尝试在编辑器窗格上使用水平滚动条进行打印时,页面的右边缘被切断了,有经验吗? Any ideas on fixing this?关于解决这个问题的任何想法?

I think this will be because the preferredSize of the viewport component is now unlimited.我认为这将是因为 viewport 组件的 preferredSize 现在是无限的。 You could try manually setting the preferredWidth of the underlying viewport component.您可以尝试手动设置底层视口组件的首选宽度。

I think that happens because printer page width is less than your JEditorPane's width.我认为这是因为打印机页面宽度小于 JEditorPane 的宽度。

You can try something like this http://java-sl.com/JEditorPanePrinter.html你可以试试这样的http://java-sl.com/JEditorPanePrinter.html

Obtain the page's widht, calculate it in pixels and set it to your JEditorPane.获取页面的宽度,以像素为单位计算并将其设置到您的 JEditorPane。 See PageFormat.请参阅页面格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM