我希望获取第一列和第二列的高度,以便知道是否需要调用document.NewPage()
。但是,如果不将表格添加到文档中,我找不到实现这一点的方法。
例如:
PdfPRow firstRow = new PdfPRow(cells1.ToArray());
table.Rows.Add(firstRow);
PdfPRow secondRow = new PdfPRow(cells2.ToArray());
table.Rows.Add(secondRow);
float h1 = table.GetRowHeight(0), h2 = table.GetRowHeight(1);
if (currentY - h1 - h2 < 30) document.NewPage();
document.Add(table);