admin管理员组文章数量:1405160
I am trying to export data from html to pdf on liferay portal 7.3.7 through openhtmltopdf 1.1.24 (tried 1.0.10 too). Sample HTML:
<html>
<head>
<style>
* {
font-family: 'Verdana';
}
</style>
</head>
<body>
<h1 id="title1">Main</h1>
<p>text under main</p>
<h2 id="subtitle1">Sub 1</h2>
<p>next text</p>
<h2 id="subtitle2">Sub 2</h2>
<p>more text</p>
</body>
</html>
and code, that is generating pdf:
PdfRendererBuilder builder = new PdfRendererBuilder();
FSSupplier<InputStream> verdana = new FSSupplier<InputStream>() {
@Override
public InputStream supply() {
return PrintArticleToPDFAction.class.getResourceAsStream("/fonts/verdana.ttf"); //need other font for special characters and PDF/A2
}
};
builder.useFont(verdana, "Verdana");
builder.toStream(outputStream);
InputStreamReader isr = new InputStreamReader(PrintArticleToPDFAction.class.getResourceAsStream("/test/test2.html"), "UTF-8"); // I have my html code in file for easier edit
String finalHtml = new BufferedReader(isr).lines().collect(Collectors.joining("\n"));
_log.info("!!!!!!!!!!!!" + finalHtml);
builder.withHtmlContent(finalHtml, null);
builder.run();
and result is this
When I try it in openhtmltopdf sandbox, it is working okay. Any suggestions, what can be problem here? Maybe something in liferay portal?
THX
本文标签: openhtmltopdf css style problem in liferay portalStack Overflow
版权声明:本文标题:openhtmltopdf css style problem in liferay portal - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744247173a2597074.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论