【问题标题】:Print WebView/WebEngine with auto page break使用自动分页符打印 WebView/WebEngine
【发布时间】:2020-02-24 18:09:54
【问题描述】:
我有一些 HTML 文本,例如
<h1>lorem... </h1>
<b> Lorem text going on...
我想在任何打印机上打印 HTML
WebEngine webEngine = WebView.getEngine();
webEngine.loadContent(html);
webEngine.print(javafx.PrinterJob);
但结果是一页在底部被切断......
chrome的打印功能具有我的意思。
【问题讨论】:
标签:
java
html
javafx
javafx-webengine
【解决方案1】:
好的。我为我的情况得到了这个解决方案。我正在使用JEditorPane
JEditorPane editorPane = new JEditorPane();
editorPane.setContentType("text/html");
editorPane.setText("<html>...");
editorPane.print(null, null, false, javax.print.PrintService, null, false);
现在有自动分页符