Reputation: 15
I am using iText 2.1.7 I write a pdf document for which the page size and contant can differ each time. What i want to achieve is a table at the very last page and at the bottom of that page. I am aware of the method 'writeSelectedRows', but with this it could happen that i overwrite text on the page, because i dont know if there is space for my table.
So in conclusion: If i have reached the last page i want to add my table at the bottom of the page. But if the table does not fit, i want a new page and on this page i want to add the table at the bottom. I could not find a solution so far.
Upvotes: 1
Views: 2579
Reputation: 356
Use this http://developers.itextpdf.com/de/node/1910 to calculate the height of a table and then check the available space on a page with PdfWriter.GetVerticalPostition(). You might want to consider your Document.BottomMargin or some other offset in your space calculation. (v4.1.6)
Upvotes: 1
Reputation: 9057
Check out this link: http://developers.itextpdf.com/content/best-itext-questions-stackoverview/general-questions-about-itext/itext7-how-find-out-current-cursor-position-page
I suppose that once you know the current cursor position on this page, you can write a simple if-statement to add a new page, or not.
Kind regards, Joris
Upvotes: -1