Java Programing laungage

iText Projects

iText Project 1

adplus-dvertising
Table create in PDF file
Previous Home Next

By help of this program we are trying to create table into the PDF file. For this operation firstly import the some package.

The most important thing is that firstly we are download the iText jar file and place it into the WEB-INFO/lib of your web application. Because without this file we can not run the program. In the iText there are two package, which is play an important role to create and manipulate to the PDF file that is java.io.* for input output, com.lowagie.text.pdf.* and com.lowgie.text.*.

Now we are going to create table into the createtablePDF file. For this firstly we are creating the file which name is createtablePDF in our work space.

Example:

package r4r;
import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
public class createtable 
	{
public static void main(String arg[])throws Exception
	{
Document doc=new Document();
PdfWriter.getInstance(doc,new FileOutputStream(
	"createtable.pdf"));
doc.open();
PdfPTable table=new PdfPTable(4);
table.addCell("Name");
table.addCell("Roll No.");
table.addCell("Mark");
table.addCell("Division");
doc.add(table);
doc.close();
}
}
Previous Home Next