您正在使用itext将html转换为PDF并使用listtag显示我的列表,但在创建的PDF中,最后一行总是被剪切。 这是我正在使用的Html:
<html>
<head>
<title>Roadmap</title>
</head>
<body>
<table class = "table2" style="border-spacing: 10px;padding: 10px;background:#f2f2f2; border:1px solid black;width:100%;color:white;font-family:'arial(body)',tahoma,arial, sans-serif;">
<tr>
<td valign="top" style="width:20%;padding:10px;background-color:#82bc00">
<ul style="margin:-15px;list-style-type: disc;">
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">AQE - PMS</li>
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">Data - Stabilization</li>
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">PMS Serverization</li>
</ul>
</td>
<td valign="top" style="width:20%;padding:10px;background-color:#f8971d">
<ul style="margin:-15px;list-style-type: disc;">
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">Instamatic Rollout</li>
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">Rollout of GR Sectoring Server</li>
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">SEC Liquidity Risk Management</li>
</ul>
</td>
<td valign="top" style="width:20%;padding:10px;background-color:#13b5ea">
<ul style="margin:-15px;list-style-type: disc;">
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">BRSRE Enhancements</li>
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">Risk Reporting Support</li>
<li style="padding:7px;line-height:1.2em;font-size:15px;font-weight: bold;">Sectoring - Product Management</li>
</ul>
</td>
</tr>
</table>
</body>
</html>
PDF中未显示最后一行管理。 谢谢你的帮助。
我的JAVA代码是:`{
// writer = PdfWriter.getInstance(document, new FileOutputStream(file));
// writer = PdfWriter.getInstance(document, response.getOutputStream());
writer = PdfWriter.getInstance(document, byteArrayOutputStream);
document.open();
HtmlPipelineContext htmlContext = new HtmlPipelineContext(null);
htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
XMLWorkerHelper.getInstance().parseXHtml(writer, document, new StringReader(htmlString));
document.close();
byte[] pdfBytes = byteArrayOutputStream.toByteArray();
return pdfBytes;
} catch (FileNotFoundException e) {
e.printStackTrace();
logger.info("File Cannot be created");
} catch (DocumentException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}`