【发布时间】:2018-01-16 21:44:55
【问题描述】:
如果表格的一部分被转发到itext中的下一页,是否可以重复表格标题。 Xml workerhelper 用于从 html 字符串创建 pdf。有时我的 html 字符串有很大的目录,内容转发到下一页。我需要在下一页添加表头并继续到目录。请查看此图片以获得更清晰的信息。
下面是用于创建 pdf 的代码。
document.open();
try{
XMLWorkerHelper.getInstance().parseXHtml(writer,
document, new ByteArrayInputStream(parserXHtml(page.getPageContent()).getBytes()));
writer.setPageEvent(orientation);
}catch(Exception e){
logger.error("Error:invalid html content detected!!");
}
document.close();
是否可以在 itextpdf Api-5.5.11 中使用。 如果我们使用表格,我们可以像这样重复表格。
PdfPTable table = new PdfPTable(2);
// header row:
table.addCell("Header");
table.addCell("Header Value");
table.setHeaderRows(1);
// many data rows:
for (int i = 1; i < 51; i++) {
table.addCell("key: " + i);
table.addCell("value: " + i);
}
我需要知道这在 xmlworkerhelper 中是可能的。
【问题讨论】: