【发布时间】:2018-12-10 07:28:28
【问题描述】:
我在尝试从 webview 转换为 pdf 时尝试在 pdf 文件的多个页面中包含页眉和页脚时遇到了一些问题。这是我如何形成要在 webview 中显示的内容:
public String toHtml() {
StringBuilder htmlStr = new StringBuilder("");
htmlStr.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html\"; charset=utf-8>");
htmlStr.append("<title>").append("").append("</title>");
htmlStr.append("</head>\n");
htmlStr.append("<body>").append("").append("</body>");
htmlStr.append("<footer>").append("").append("</footer>");
htmlStr.append("</html>");
return htmlStr.toString();
}
我跟着this guide 从 webview 生成 PDF。它确实设法生成了 PDF 文件。但是,页眉只出现在 PDF 文件的第一页,页脚只出现在 PDF 文件的最后一页。任何想法如何在 PDF 文件的所有页面中包含页眉和页脚?
谢谢!
【问题讨论】:
-
hi @hyperfkcb 您在问题中提到的链接,我们可以使用 webview 在 pdf 中创建多个页面吗?你能帮我解决我的问题吗stackoverflow.com/questions/54870164/…
-
我也有同样的问题。你找到解决办法了吗?你能帮我么?请