EricKinat wrote:
Am I doing something wrong with nested lists?  I'm trying to extend the
sample in Chapter 4 (iText in Action) that reads in a simple HTML document
to allow for nested lists.

I'm sorry, I can't reproduce the problem.
See attachments.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

Attachment: testlist.pdf
Description: Adobe PDF document

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.List;
import com.lowagie.text.ListItem;
import com.lowagie.text.pdf.PdfWriter;


public class TestList {

        public static void main(String[] args) throws IOException, 
DocumentException {
                Document document = new Document();
                PdfWriter.getInstance(document, new 
FileOutputStream("testlist.pdf"));
                document.open();
                List list1 = new List(List.ALPHABETICAL, 20);
        list1.add(new ListItem(new Chunk("Level 1 - Item 1")));
        list1.add(new ListItem(new Chunk("Level 1 - Item 2")));
        list1.add(new ListItem(new Chunk("Level 1 - Item 3")));

        List list2 = new List(List.ORDERED, 20);
        list2.add(new ListItem(new Chunk("Level 2 - Item 1")));
        list2.add(new ListItem(new Chunk("Level 2 - Item 2")));

        List list3 = new List(List.ORDERED, 20);
        list3.add(new ListItem(new Chunk("Level 3 - Item 1")));
        list3.add(new ListItem(new Chunk("Level 3 - Item 2")));
        list3.add(new ListItem(new Chunk("Level 3 - Item 3")));
        list3.add(new ListItem(new Chunk("Level 3 - Item 4")));
        list2.add(list3); 

        //list2.add(new ListItem(new Chunk("Level 2 - Item 3")));
        list1.add(list2);

        list1.add(new ListItem(new Chunk("Level 1 - Item 4")));

        document.add(list1);
                document.close();
        }
}
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
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