private Font bigFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD);
private Font mediumFont = new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD);
private Font bold = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
public void generatePDF() throws DocumentException, IOException {
Document document = new Document(PageSize.A4.rotate());
document.setPageSize(PageSize.A4);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfWriter.getInstance(document, baos);
document.open();
/* Add MTAMS LOGO */
String url = FacesContext.getCurrentInstance().getExternalContext().getRealPath("resources/img/logo.PNG");
Image image = Image.getInstance(url);
document.add(image);
document.addTitle("MTAMS - Application");
document.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date()));
/* Add PDF Content */
pdfContent(document);
document.close();
/* Ouput PDF as attachment */
String fileName = (this.travelerP.getFamilyname()
+ this.travelerP.getIdtravelerprofile()
+ "ForexForm");