Iliadis Yannis wrote:
> This works fine if I am using one large table, but in case of smaller 
> tables it splits the last one, leaving orphans.
> 
> I've tried using setSplitLate and setSplitRows on the tables but without 
> any result.

These methods define the cell splitting behavior.
They are not for determining if a complete table
fits the page or not.

> So my question is how can I solve this issue.

It's odd that you fill the ColumnText first,
then perform go(). I would:

while (more tables) {
   - add a table to the column
   - invoke go() on the column
}

instead of:

while (more tables) {
   - add a table to the column
}
while (true) {
   - invoke go() on the column
}

Your design doesn't allow you to make any decision
about individual tables. My design allows me to
elaborate on the second step.

Different scenarios are possible.
(1) You can calculate the height of each table (p184)
and ask the column for its current Y position. Subtract
the height from the Y position and you can evaluate if
you want the table to split or you want to forward it
to the next page.
(2) You can add the column in simulation mode and find
out if it fits the page; you can also compare the previous
with the current Y position. Depending on your tests, you
can decide to add the column for real on the current page,
on the next page, or allow iText to split the table.
(3) ... with some imagination, I could probably come up
with more possibilities.

> A second issue is that despite defining a placeholder in the template 
> (textfield) to create the boundaries of the columntext, the tables 
> placed in it seam to be narrower in the output pdf.

I may have overlooked this, but I don't see you setting the
width of the table anywhere. As described in chapter 6, the
width of a table is 80% of the available width by default.
If you go for solution (1), you may want to set the total
width and lock it (p165).

br,
Bruno

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to