Thank you so much, but we still have 2 kinds of problem... problem 1) It seems I'm not able to work in text mode using MultiColumnText class but only in composite mode problem 2) If I add only irregular columns and I'm in the condition where maxY < top, it LOOPs
please try the code I sent with attachement, you'll find several usefull situation adding 2 columns: case 1) regular + regular & maxY > top: I'm adding Chunks but it adds Paragraphs case 2) maxY < top: I'm adding Chunks but it adda Paragraphs case 3) irregular + regular & maxY > top: OK case 4) maxY < top: the irregular column disappear on the left case 5) regular + irregular & maxY > top: OK case 6) maxY < top: the irregular column disappear on the right case 7) irregular + irregular & maxY > top: OK case 8) maxY < top: LOOP For problem 1 I suggested to modify the addElement method, but you said that "If the columns are rectangular, YOU MUST use addElement", why? In the chapter 7 of your book it's not forbidden to use addText and addElement toghether! I tryed my modify adding Chunks and Paragraphs and it seems to work. Don't you think it's only a limitation to MultiColumnText class? Maybe you can add the addText method too... For problem 2 I think you have to find something in the ColumnText class beacause if you change my test code using ColumnText you'll find the same problem. Leonardo ----- Original Message ----- From: "1T3XT info" <[email protected]> To: "Post all your questions about iText here" <[email protected]> Sent: Tuesday, January 06, 2009 12:21 PM Subject: Re: [iText-questions] Bug inside MultiColumnText > 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
Test.java
Description: Binary data
------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB
_______________________________________________ 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
