I'm using ItextSharp to create a PDF document with multiple PdfPTables. I group multiple PdfPTables using a list, and the list is created in a function and returned as a list. I then take the list and loop through it to add each PdfPTable to the document.
In the case that the next PdfPTable in the list is larger than the remaining space on the document I want to add a new page.
Using a breakpoint, I've noticed that "table.TotalHeight" always returns 0, when I expect it to return a positive float value. I might be misunderstanding the way table.TotalHeight works, but to my understanding it should return the total height of the individual table.
for (count1 = 0; count1 < testQuote.Count + 1; count1++)
{
var list = BuildDetail(testQuote, count1);
foreach (PdfPTable table in list)
{
if (table.TotalHeight > (writer.GetVerticalPosition(false) - doc.BottomMargin))
{
doc.Add(new Paragraph("Quote continues on next page"));
doc.NewPage();
}
doc.Add(new Paragraph(" "));
doc.Add(table);
}