FileOutputStream out = new FileOutputStream(new File("./WebContent/WEB-INF/Data/test.pdf"));
Document document = new Document();
PdfWriter.getInstance(document, out);
PdfPTable table = new PdfPTable(3);
PdfPCell cell = new PdfPCell(new Paragraph ("Java4s.com"));
cell.setColspan(3);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setPadding(10.0f);
cell.setBackgroundColor(new BaseColor(0, 255, 48));
table.addCell(cell);
document.open();
String k = "<html><body> <b>This is my Project </b></body></html>";
PdfPCell cell1 = new PdfPCell (new Paragraph ("Java4s.com"));
HTMLWorker htmlWorker = new HTMLWorker(document);
htmlWorker.parse(new StringReader(k));
cell1.setColspan(3);
table.addCell(cell1);
table.setSpacingBefore(30.0f);
table.setSpacingAfter(30.0f);