I want to get the first and second column height to know if I need to call document.NewPage() or not. But, I can’t find a way to do this without adding the table to the document.
Example:
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);
See my answer here. Basically, you can’t know the dimensions of a table until it renders. However, you can render the table to a document that you just throw away and then re-render it later.