Java Programing laungage

iText Projects

iText Project 1

adplus-dvertising
Creating multiple list in PDF file
Previous Home Next

The iText is a very power full Application programming language which is used for the creating the PDF file and manipulating them. Actually the iText is a library of the file in which many class and interface is included. These class and interfaces are provide the help to complete the task of creation of PDF file in easy way.

By help of this program we are trying to tell you that how we can make multiple list into a PDF file. We can make lists and also sublist into the PDF file. We can make symbolic or ordered list.

In java iText API provides facility to make list into the PDF file. It List may be ordered or unordered. It is Depending our requirement. we can create both type of list.

For performing this action some package used in the program . These are listed bellow:

  1. import com.lowagie.text.Listt;
  2. import com.lowagie.text.Listitem;
  3. Example:

    package r4r;
    import java.io.FileOutputStream;
    import com.lowagie.text.Chunk;
    import com.lowagie.text.Document;
    import com.lowagie.text.Font;
    import com.lowagie.text.FontFactory;
    import com.lowagie.text.List;
    import com.lowagie.text.ListItem;
    import com.lowagie.text.Paragraph;
    import com.lowagie.text.pdf.PdfWriter;
    
    public class multilelisttest 
    	{
    public static void main(String[] args)throws Exception 
    	{
    System.out.println("Creation object of List");
    
    Document doc = new Document();
    PdfWriter.getInstance(doc, new FileOutputStream
    ("multiplelisttest.pdf"));
    
    doc.open();
    List lt = new List(true, 20);
    lt.add(new ListItem("Java"));
    lt.add(new ListItem("Dot net"));
    lt.add(new ListItem("SEO"));
    doc.add(lt);
    doc.add(new Paragraph(
    "This Tutorials Provided By R4R"));
    
    ListItem lItem;
    lt = new List(true, 15);
    lItem = new ListItem("Java", 
    FontFactory.getFont(FontFactory.TIMES_ROMAN, 13));
    
    lItem.add(new Chunk(" By R4R", FontFactory.getFont(
    FontFactory.TIMES_ROMAN, 13, Font.ITALIC)));
    
    lt.add(lItem);
    lItem = new ListItem("Dot net", FontFactory.getFont(
    FontFactory.TIMES_ROMAN, 12));
    
    lItem.add(new Chunk(" By R4R", FontFactory.getFont(
    FontFactory.TIMES_ROMAN, 13, Font.ITALIC)));
    
    lt.add(lItem);
    lItem = new ListItem("SEO", 
    FontFactory.getFont(FontFactory.TIMES_ROMAN, 12));
    
    lItem.add(new Chunk(" By R4R", FontFactory.getFont(
    FontFactory.TIMES_ROMAN, 13, Font.ITALIC)));
    
    lt.add(lItem);
    doc.add(lt);
    Paragraph par = new Paragraph("Open source");
    lt = new List(false, 10);
    lt.add("server net bean");
    lt.add("java");
    lt.add("My SQL");
    par.add(lt);
    doc.add(par);
    doc.add(new Paragraph("iText Example"));
    lt = new List(false, 20);
    lt.setListSymbol(new Chunk("\u2021", FontFactory.getFont(
    FontFactory.HELVETICA, 21, Font.BOLD)));
    
    lItem = new ListItem(
    "Generates a simple 'Hello Java' PDF file");
    
    lt.add(lItem);
    List slist;
    slist = new List(false, true, 10);
    slist.setListSymbol(new Chunk("", FontFactory.getFont(
    FontFactory.HELVETICA, 7)));
    
    slist.add("Creating Paragraph using iText");
    slist.add("Insert Image using iText");
    slist.add("Rotate image using iText.");
    slist.add("alignment to test Using iText");
    lt.add(slist);
    lItem = new ListItem("Craeting table object using iText");
    lt.add(lItem);
    slist = new List(false, true, 10);
    slist.setFirst('a');
    slist.setListSymbol(new Chunk("", FontFactory.getFont(
    FontFactory.HELVETICA, 7)));
    
    slist.add("Creating Table object using iText ");
    slist.add("creating a table with title using iText");
    slist.add("Creating list object using iText ");
    slist.add("Creating multiplelist object using iText ");
    lt.add(slist);
    lItem = new ListItem("Creating list object using iText ");
    lt.add(lItem);
    slist = new List(false, true, 10);
    slist.setListSymbol(new Chunk("", FontFactory.getFont(
    FontFactory.HELVETICA, 7)));
    
    slist.add("Core java ");
    slist.add("Advanced java ");
    slist.add("struts ");
    slist.add("hibernate");
    lt.add(slist);
    doc.add(lt); 
    doc.close();
    }
    }
    
    Previous Home Next