import java.io.FileOutputStream;

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

public class Test2 {
	public static void main(String[] args) throws Exception {
		System.out.println("begin");

		Document document = new Document();
		PdfWriter.getInstance(document, new FileOutputStream("lists.pdf"));
		document.open();

		List list = new List(true, 20);
		list.add(new ListItem("First line"));
		list.add(new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?"));
		list.add(new ListItem("Third line"));
		
		List list2 = new List(true, 20);
		list2.add(new ListItem("First line"));
		list2.add(new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?"));
		list2.add(new ListItem("Third line"));
		
		ListItem item = new ListItem();
		item.add(new Chunk("line 4"));
		item.add(list2);
		list.add(item);
		list.add(new ListItem("line 5"));
		document.add(list);
		document.newPage();
		
		MultiColumnText cols = new MultiColumnText();
		cols.addRegularColumns(30, 560, 10, 4);
		cols.addElement(list);
		document.add(cols);

		document.close();

		System.out.println("done");
	}
}