使用iText 5.5.7在由于分页符而拆分表时添加java空白页
我有一些使用iText 2.1.7的代码。我们决定使用最新版本的iText。我用5.5.6版测试了代码,代码也运行得很好
上个月5.5.7版发布时,我们决定升级到该版本,因为它对使用嵌套表和拆分行时的性能进行了一些修复,这些似乎与项目有关
但是,在某些情况下,当表格因分页符而拆分时,会向PDF中添加空白页。正如我所说,该代码在iText 2.1.7和iText 5.5.6中运行良好
以下是用于构建表的代码:
float[] widthsIllustration = { 0.75f, 8 };
PdfPTable tableIllustration = ReportBuilderCommon.buildTable(2, 100, widthsIllustration);
tableIllustration.setSplitLate(false);
tableIllustration.getDefaultCell().setBorder(Rectangle.BOTTOM);
tableIllustration.getDefaultCell().setPaddingBottom(5);
上面的表嵌套在另一个这样创建的表中
PdfPTable leftColumn = ReportBuilderCommon.buildTable(1, 100);
leftColumn.setSplitLate(false);
以下是方法buildTable
:
public static PdfPTable buildTable(final int numColums, final float widthPercentage) throws DocumentException {
PdfPTable table = new PdfPTable(numColums);
table.setWidthPercentage(widthPercentage);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
return table;
}
共 (0) 个答案