ITextSharp and moving some data to the next page

I create an account using iTextSharp. This is displayed well, but sometime when the elements of the account are larger in number, the summary part (which shows subtotals, taxes, discounts, total, etc.) is divided. Some appear on the current page, and some move to the next page. I thought to move the entire summary to the next page if the current height is not enough for this.

However, for this I need to know how tall the page is (after my current rendering of the page content). I wonder if anyone knows how to calculate the current left page height? OR, if there is a property in the pdfPTable file that can cause the table to print itself as a whole and prevent it from being split into several pages! I think if the second option is available, it will be easy.

In conclusion, I need to know whether it is possible to calculate the remaining page height, and also, if possible, to make the table NOT divided into several pages.

Thank you. Sameers

+3
source share
3 answers

SplitLate false, , .

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

table.SplitLate = false;
......
+10

. , IText , ( ) .

, .

, .

+1

PDF? MultiColumnText, , ?

Document.PageSize.Height, .

PDFPTable.Height, .

So just use the logic of Document.PageSize.Height - table.Height, and you will have the remaining free space of the y axis.

The PDFPTable object has properties named SplitLate and SplitRows. I believe that you can use these properties for try and save the table on one page.

0
source

Source: https://habr.com/ru/post/1769182/


All Articles