Leo wrote:
If you changed the addColumn order adding column2 first and then column1, it worked but the right column in the page was filled first with a bad graphic effect!

With this revision the problem was solved and probably the correct bugfix was to change the simple parameter and not the addElement method.

However, now there's another problem adding line 305:
left[1] = documentY
from the second page on the left column disappeared!

You are correct: the hack didn't work; it was removed. Thanks for testing this! If you have further questions, please use the Java file in attachment; that is easier than a copy/paste of code in a mail message.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info
import java.io.FileOutputStream;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.MultiColumnText;
import com.lowagie.text.pdf.PdfWriter;

public class Test
{
    public static void main ( String[] args ) throws Exception
    {
        int mLeft = 40;
        int mRight = 40;
        int mTop = 50;
        int mBottom = 50;
        Document document = new Document(PageSize.A4, mLeft, mRight, mTop, 
mBottom);
        PdfWriter.getInstance(document, new FileOutputStream("xxx.pdf"));
        document.open();
         
        Font font1 = new Font(Font.COURIER, 10f);
        Chunk text = new Chunk("one two three four five six seven eight nine 
ten ", font1);
        MultiColumnText column = new MultiColumnText();
        float[][] column1 = {
                {50,800,50,50},
                {200,800,200,700,150,600,200,500,200,50}
        };

        float[][] column2 = {
                {250,800,250,50},
                {500,800,500,50}
        };
        column.addColumn(column1[0], column1[1]);
        column.addColumn(column2[0], column2[1]);
        for (int i = 0; i < 100; i++) {
        column.addElement(text);
        }
        column.setAlignment(MultiColumnText.ALIGN_JUSTIFIED);
        document.add(column);
        document.close();
    }
} 
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to