iTextSharp and moving some data to next page

Sameers Javed picture Sameers Javed · Oct 12, 2010 · Viewed 11.3k times · Source

I am creating an invoice using the iTextSharp. That displays nicely but sometime, when invoice items are larger in qty, the summary portion (which displays subtotal, tax, discounts, grand total etc) is splitted. Some displayes in current page and some moves to next page. I was thinking to move entire summary portion into next page, if current height left is not enough for that.

However, to do that, I need to know that how much page height is left (after my current page content rendering). I wonder if someone know how to calculate current left height of the page? OR if there is a property in the pdfPTable which may force the table to print itself as a whole and dont let it split across multiple pages! I guess if second option is available, it will be easy.

In summary, I need to know if it is possible to calculate remaining page height, and also if that is possible to force a table to NOT split across multiple pages.

thank you. Sameers

Answer

Knowledgeserve picture Knowledgeserve · Oct 18, 2011

You can set SplitLate to false to avoid auto page break in a cell data exceeds limit.

......
table.addCell(cellData);

table.SplitLate = false;
......