Matt White wrote:

Bruno -

Now we're getting somewhere, it no longer goes into a loop. :)

Attached is another example. As I understand the way MultiColumnText works, it 
should produce three columns at the bottom of the page.

No, that would be the case if you had defined three irregular columns.
Instead you have defined regular columns and only the left and right
value were taken into account, NOT the top and bottom value.

Instead, it ignores the Y of the columns that I set, and puts them at the top 
of the page.
I haven't written the MultiColumnText class, but that's the way it was
designed. MultiColumnText is supposed to be a simple class for people
who are afraid of using ColumnText (if you had started writing your code
with ColumnText, you wouldn't have had all these problems).

Anyway, this is a good opportunity to add some extra MultiColumnText
features, so I added a new constructor to the MultiColumnText class in
the CVS repository.

It reduces your code to this:

Document document = new Document(PageSize.LETTER.rotate());
OutputStream out = new FileOutputStream("columntest.pdf");
PdfWriter writer = PdfWriter.getInstance(document, out);
document.open();
MultiColumnText mct = new MultiColumnText(TOP_OF_PAGE - 400, TOP_OF_PAGE - 400 - BOTTOM_OF_PAGE - 9); mct.addRegularColumns(LEFT_COLUMN_LEFT_BORDER, RIGHT_COLUMN_RIGHT_BORDER, 8, 3);
loop with mct.addElement(...);
document.add(mct);

No more iteration, just create the column text object
with a top value, a desired height, define the regular
columns, add the content and you have a mct object
that can be added to the document without checking
if there is an overflow.

br,
Bruno




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to