Hello,

i don't now if i had found a bug or a feature. If i use the Constructor
ot the ListItem, every chunk added to the ListItem is wrong formated.
I've seen that there is a master font in the phrase class.
With an empty Constructer all is ok. I'm using now the first way of
my example. But trying costs time ;-)

Thanks for this great lib.
Christian Sowada


import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.List;
import com.lowagie.text.ListItem;
import com.lowagie.text.pdf.PdfWriter;


public class Bug {


        public static void main(String[] args) {
                Document document = new Document();
                try {
                        PdfWriter.getInstance(document, new 
FileOutputStream("FloatingBoxes2.pdf"));
                        document.open();

                        List list1 = new List(false, 10f);


                        Font f1 = new Font();
                        f1.setStyle(Font.BOLDITALIC);
                        Chunk chunk1 = new Chunk("I'am bolditalic!", f1);

                        Font f2 = new Font();
                        f2.setStyle(Font.NORMAL);
                        Chunk chunk2 = new Chunk("I'am normal?", f2);

                        ListItem item = new ListItem();
                        item.add(chunk1);
                        item.add(chunk2);
                        list1.add(item);

                        document.add(list1);

                        // And now the Bug (or Feature?) by the ListItem 
Constructor

                        List list2 = new List(false, 10f);
                        item = new ListItem(chunk1);
                        item.add(chunk2);

                        list2.add(item);

                        document.add(list2);

                } catch (DocumentException de) {
                        System.err.println(de.getMessage());
                } catch (IOException ioe) {
                        System.err.println(ioe.getMessage());
                }
                document.close();
        }
}
-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to