import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Cell;
import com.itextpdf.layout.element.Table;
public class AddingTableToPDF {
public static void main(String args[]) throws Exception
{
String file
= "C:/EXAMPLES/itextExamples/addingTableToPDF.pdf";
PdfDocument pdfDoc
= new PdfDocument(new PdfWriter(file));
Document doc = new Document(pdfDoc);
Table table = new Table(2);
table.addCell(new Cell().add("Name"));
table.addCell(new Cell().add("Raju"));
table.addCell(new Cell().add("Id"));
table.addCell(new Cell().add("1001"));
table.addCell(new Cell().add("Designation"));
table.addCell(new Cell().add("Programmer"));
doc.add(table);
doc.close();
System.out.println("Table created successfully..");
}
}