Last row on the first page in iText table isn't drawing border at baseline of the font like all the other rows when table is split across pages
下面有一个示例,该示例生成一个包含十行的表,最后一行占用两行。 文档高度比正确放置整个桌子所需的高度小两点。 正如预期的那样,第一页的最后一行包含单词" Two"," Lines"部分在另一页上继续。 但是,生成的PDF会扩展最后一行以适合整个文档(不包括页边距填充),而不是使用最后一行中的文本高度来确定其高度。 请注意,我使用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | FileOutputStream out = new FileOutputStream(new File("table.pdf")); Document document = new Document(new Rectangle(612, 242)); PdfWriter.getInstance(document, out); document.open(); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100); table.setSplitLate(false); table.setSplitRows(true); table.setExtendLastRow(false, false); for (int i = 0; i < 10; i++) { PdfPCell cell; if (i == 9) { cell = new PdfPCell(new Phrase("Two\ Lines")); } else { cell = new PdfPCell(new Phrase(Integer.toString(i))); } table.addCell(cell); } document.add(table); document.close(); |
我上传了一张我所看到的照片。 请注意,单词" Two"下的间距不同于行中所有其他数字下的间距。 它似乎延伸到页边距的底部。
这是预期的行为,并且iText当前不支持这种极端情况。