Example usage for com.lowagie.text.pdf PdfPCell setBorder

List of usage examples for com.lowagie.text.pdf PdfPCell setBorder

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPCell setBorder.

Prototype

public void setBorder(int border) 

Source Link

Document

Enables/Disables the border on the specified sides.

Usage

From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java

License:Open Source License

public void printDocHeaderFooter() throws DocumentException {
    String headerTitle = demographic.getFormattedName() + " " + demographic.getAge() + " "
            + demographic.getSex() + " DOB:" + demographic.getFormattedDob();

    //set up document title and header
    ResourceBundle propResource = ResourceBundle.getBundle("oscarResources");
    String title = propResource.getString("oscarEncounter.pdfPrint.title") + " "
            + (String) request.getAttribute("demoName") + "\n";
    String gender = propResource.getString("oscarEncounter.pdfPrint.gender") + " "
            + (String) request.getAttribute("demoSex") + "\n";
    String dob = propResource.getString("oscarEncounter.pdfPrint.dob") + " "
            + (String) request.getAttribute("demoDOB") + "\n";
    String age = propResource.getString("oscarEncounter.pdfPrint.age") + " "
            + (String) request.getAttribute("demoAge") + "\n";
    String mrp = propResource.getString("oscarEncounter.pdfPrint.mrp") + " "
            + (String) request.getAttribute("mrp") + "\n";
    String[] info = new String[] { title, gender, dob, age, mrp };

    ClinicData clinicData = new ClinicData();
    clinicData.refreshClinicData();/*from  w w  w . j a  va 2 s .c  o m*/
    String[] clinic = new String[] { clinicData.getClinicName(), clinicData.getClinicAddress(),
            clinicData.getClinicCity() + ", " + clinicData.getClinicProvince(), clinicData.getClinicPostal(),
            clinicData.getClinicPhone() };

    if (newPage) {
        document.newPage();
        newPage = false;
    }

    //Header will be printed at top of every page beginning with p2
    Phrase headerPhrase = new Phrase(LEADING, headerTitle, boldFont);
    HeaderFooter header = new HeaderFooter(headerPhrase, false);
    header.setAlignment(HeaderFooter.ALIGN_CENTER);
    document.setHeader(header);

    getDocument().add(headerPhrase);
    getDocument().add(new Phrase("\n"));

    Paragraph p = new Paragraph("Tel:" + demographic.getPhone(), getFont());
    p.setAlignment(Paragraph.ALIGN_LEFT);
    // getDocument().add(p);

    Paragraph p2 = new Paragraph("Date of Visit: ", getFont());
    p2.setAlignment(Paragraph.ALIGN_RIGHT);
    // getDocument().add(p);

    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100f);
    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);
    PdfPCell cell1 = new PdfPCell(p);
    cell1.setBorder(PdfPCell.NO_BORDER);
    cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
    PdfPCell cell2 = new PdfPCell(p2);
    cell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell2.setBorder(PdfPCell.NO_BORDER);
    table.addCell(cell1);
    table.addCell(cell2);

    getDocument().add(table);

    table = new PdfPTable(3);
    table.setWidthPercentage(100f);
    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);
    cell1 = new PdfPCell(getParagraph("Signed Provider:" + ((signingProvider != null) ? signingProvider : "")));
    cell1.setBorder(PdfPCell.NO_BORDER);
    cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2 = new PdfPCell(getParagraph("RFR:"));
    cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell2.setBorder(PdfPCell.NO_BORDER);
    PdfPCell cell3 = new PdfPCell(getParagraph("Ref:"));
    cell3.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell3.setBorder(PdfPCell.NO_BORDER);
    table.addCell(cell1);
    table.addCell(cell2);
    table.addCell(cell3);

    getDocument().add(table);

    //Write title with top and bottom borders on p1
    cb = writer.getDirectContent();
    cb.setColorStroke(new Color(0, 0, 0));
    cb.setLineWidth(0.5f);

    cb.moveTo(document.left(), document.top() - (font.getCalculatedLeading(LINESPACING) * 5f));
    cb.lineTo(document.right(), document.top() - (font.getCalculatedLeading(LINESPACING) * 5f));
    cb.stroke();
}

From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java

License:Open Source License

private PdfPCell generalCellForApptHistory(String text) {
    Paragraph p = new Paragraph(text, getFont());
    p.setAlignment(Paragraph.ALIGN_LEFT);
    PdfPCell cell1 = new PdfPCell(p);
    cell1.setBorder(PdfPCell.NO_BORDER);
    cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
    return cell1;

}

From source file:org.oscarehr.common.service.PdfRecordPrinter.java

License:Open Source License

public void printDocHeaderFooter() throws DocumentException {
    document.resetHeader();//from w ww. j a  v a 2  s.  co  m
    document.resetFooter();
    //document.resetPageCount();
    String headerTitle = demographic.getFormattedName() + " " + demographic.getAge() + " "
            + demographic.getSex() + " DOB:" + demographic.getFormattedDob();

    //set up document title and header
    ResourceBundle propResource = ResourceBundle.getBundle("oscarResources");
    String title = propResource.getString("oscarEncounter.pdfPrint.title") + " "
            + (String) request.getAttribute("demoName") + "\n";
    String gender = propResource.getString("oscarEncounter.pdfPrint.gender") + " "
            + (String) request.getAttribute("demoSex") + "\n";
    String dob = propResource.getString("oscarEncounter.pdfPrint.dob") + " "
            + (String) request.getAttribute("demoDOB") + "\n";
    String age = propResource.getString("oscarEncounter.pdfPrint.age") + " "
            + (String) request.getAttribute("demoAge") + "\n";
    String mrp = propResource.getString("oscarEncounter.pdfPrint.mrp") + " "
            + (String) request.getAttribute("mrp") + "\n";
    String[] info = new String[] { title, gender, dob, age, mrp };

    ClinicData clinicData = new ClinicData();
    clinicData.refreshClinicData();
    String[] clinic = new String[] { clinicData.getClinicName(), clinicData.getClinicAddress(),
            clinicData.getClinicCity() + ", " + clinicData.getClinicProvince(), clinicData.getClinicPostal(),
            clinicData.getClinicPhone() };

    if (newPage) {
        document.newPage();
        newPage = false;
    }

    //Header will be printed at top of every page beginning with p2

    Phrase headerPhrase = new Phrase(LEADING, headerTitle, boldFont);
    /*
            HeaderFooter header = new HeaderFooter(headerPhrase,false);
            header.setAlignment(HeaderFooter.ALIGN_CENTER);
            document.setHeader(header);
    */
    getDocument().add(headerPhrase);
    getDocument().add(new Phrase("\n"));

    Paragraph p = new Paragraph("Tel:" + demographic.getPhone(), getFont());
    p.setAlignment(Paragraph.ALIGN_LEFT);
    // getDocument().add(p);

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    Paragraph p2 = new Paragraph("Date of Visit: " + sdf.format(appointment.getAppointmentDate()), getFont());
    p2.setAlignment(Paragraph.ALIGN_RIGHT);
    // getDocument().add(p);

    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100f);
    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);
    PdfPCell cell1 = new PdfPCell(p);
    cell1.setBorder(PdfPCell.NO_BORDER);
    cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
    PdfPCell cell2 = new PdfPCell(p2);
    cell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell2.setBorder(PdfPCell.NO_BORDER);
    table.addCell(cell1);
    table.addCell(cell2);

    getDocument().add(table);

    table = new PdfPTable(3);
    table.setWidthPercentage(100f);
    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);
    cell1 = new PdfPCell(getParagraph("Signed Provider:" + ((signingProvider != null) ? signingProvider : "")));
    cell1.setBorder(PdfPCell.BOTTOM);
    cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2 = new PdfPCell(getParagraph("RFR:" + this.appointment.getReason()));
    cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell2.setBorder(PdfPCell.BOTTOM);
    PdfPCell cell3 = new PdfPCell(getParagraph("Ref:" + this.getRefName(this.demographic)));
    cell3.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell3.setBorder(PdfPCell.BOTTOM);
    table.addCell(cell1);
    table.addCell(cell2);
    table.addCell(cell3);
    getDocument().add(table);

    /*
    HeaderFooter footer = new HeaderFooter(new Phrase("-",font),new Phrase("-",font));
    footer.setAlignment(HeaderFooter.ALIGN_CENTER);
    footer.setBorder(0);
            
    document.setFooter(footer);
    */

    //Write title with top and bottom borders on p1

    // cb = writer.getDirectContent();
    /*
    cb.setColorStroke(new Color(0,0,0));
    cb.setLineWidth(0.5f);
    * 
    cb.moveTo(document.left(), document.top() - (font.getCalculatedLeading(LINESPACING)*5f));
    cb.lineTo(document.right(), document.top() - (font.getCalculatedLeading(LINESPACING)*5f));
    cb.stroke();     
    */
}

From source file:org.oscarehr.common.service.PdfRecordPrinter.java

License:Open Source License

public void printSpecsHistory(List<EyeformSpecsHistory> specsHistory) throws DocumentException {
    ProviderDao providerDao = (ProviderDao) SpringUtils.getBean("providerDao");

    /*/* w ww . ja  va 2s  . com*/
         if( getNewPage() )
    getDocument().newPage();
           else
    setNewPage(true);
    */

    Font obsfont = new Font(getBaseFont(), FONTSIZE, Font.UNDERLINE);

    Paragraph p = new Paragraph();
    p.setAlignment(Paragraph.ALIGN_LEFT);
    Phrase phrase = new Phrase(LEADING, "\n", getFont());
    p.add(phrase);
    phrase = new Phrase(LEADING, "Specs History", obsfont);
    p.add(phrase);
    getDocument().add(p);

    PdfPTable table = new PdfPTable(2);
    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);
    table.setSpacingBefore(10f);
    table.setSpacingAfter(10f);
    table.setTotalWidth(new float[] { 10f, 60f });
    table.setTotalWidth(5f);
    table.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);

    for (EyeformSpecsHistory specs : specsHistory) {
        PdfPCell cell1 = new PdfPCell(new Phrase(getFormatter().format(specs.getDate()), getFont()));
        cell1.setBorder(PdfPCell.NO_BORDER);
        cell1.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        table.addCell(cell1);

        PdfPCell cell2 = new PdfPCell(new Phrase(specs.toString2(), getFont()));
        cell2.setBorder(PdfPCell.NO_BORDER);
        cell2.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        table.addCell(cell2);
    }

    getDocument().add(table);
}

From source file:org.oscarehr.web.reports.ocan.IndividualNeedRatingOverTimeReportGenerator.java

License:Open Source License

private PdfPCell makeCell(Phrase phrase, int alignment) {
    PdfPCell c2 = new PdfPCell();
    c2.setPhrase(phrase);//from   w w w  . j  a v a2  s .  c  o  m
    c2.setHorizontalAlignment(alignment);
    c2.setBorder(0);
    return c2;
}

From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java

License:Open Source License

private void addSummaryOfNeedsHeader(PdfPTable summaryOfNeedsTable,
        List<OcanNeedRatingOverTimeSummaryOfNeedsBean> currentBeanList, int loopNo) {

    PdfPCell headerCell = new PdfPCell();
    headerCell.setPhrase(new Phrase("Summary of Needs" + (loopNo > 1 ? " (Contd.)" : ""),
            new Font(Font.HELVETICA, 20, Font.BOLD)));

    headerCell.setColspan(currentBeanList.size() * 3);
    headerCell.setVerticalAlignment(Element.ALIGN_TOP);
    headerCell.setBorder(0);
    headerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    summaryOfNeedsTable.addCell(headerCell);

    Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE);
    //row1//from   w w  w.  j  a v  a  2 s  . co m
    PdfPCell c2 = null;

    c2 = new PdfPCell();
    c2.setBorder(0);
    summaryOfNeedsTable.addCell(c2);
    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(0).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(0).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(1).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(1).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(2).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(2).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }

    //row2
    c2 = new PdfPCell();
    c2.setBorder(0);
    summaryOfNeedsTable.addCell(c2);

    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
}

From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java

License:Open Source License

private void addSummaryOfNeedsDomainHeader(PdfPTable summaryOfNeedsTable,
        List<OcanNeedRatingOverTimeNeedBreakdownBean> currentBeanList, int loopNo) {

    Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE);
    //row1/*from  www.  j  av  a2  s  .c  om*/
    PdfPCell c2 = null;

    c2 = new PdfPCell();
    c2.setBorder(0);
    summaryOfNeedsTable.addCell(c2);

    if (loopNo > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
    }

    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(0).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(0).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(1).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(1).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(2).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(2).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }

    //row2
    c2 = new PdfPCell();
    c2.setBackgroundColor(Color.BLUE);
    c2.setPhrase(new Phrase("Domains", f));
    c2.setHorizontalAlignment(Element.ALIGN_CENTER);
    summaryOfNeedsTable.addCell(c2);

    if (loopNo > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
    }

    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }

}

From source file:org.oscarehr.web.reports.ocan.SummaryOfActionsAndCommentsReportGenerator.java

License:Open Source License

private void createDomainHeader(PdfPTable table, String name) {
    Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.BLACK);
    PdfPCell emptyCell = new PdfPCell();
    emptyCell.setBorder(0);
    table.addCell(emptyCell);//from www  . j  a va 2  s  .  c o  m

    PdfPCell headerCell = new PdfPCell();
    headerCell.setColspan(2);
    headerCell.setPhrase(new Phrase(name, f));
    headerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    headerCell.setBackgroundColor(Color.LIGHT_GRAY);
    table.addCell(headerCell);
}

From source file:org.oscarehr.web.reports.ocan.SummaryOfActionsAndCommentsReportGenerator.java

License:Open Source License

private PdfPTable createNeedHeader(String name) throws DocumentException {
    Font whiteFont = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE);
    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100);/*from w  w w .  j av  a2 s  .  co m*/
    table.setWidths(new float[] { 0.10f, 0.20f, 0.70f });
    PdfPCell emptyCell = new PdfPCell();
    emptyCell.setBorder(0);
    table.addCell(emptyCell);

    PdfPCell headerCell = new PdfPCell();
    headerCell.setColspan(2);
    headerCell.setPhrase(new Phrase(name, whiteFont));
    headerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    headerCell.setBackgroundColor(Color.LIGHT_GRAY);
    table.addCell(headerCell);
    return table;
}

From source file:org.revager.export.InvitationPDFExporter.java

License:Open Source License

/**
 * Write the title page of the PDF document.
 * // w w  w .j a v a2 s  .  c  om
 * @throws ExportException
 *             If an error occurs while creating the title page
 */
private void writeTitlePage() throws ExportException {
    try {
        Font plainFontTitle = new Font(
                BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 12);

        Font boldFontTitle = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 12);

        Font boldItalicFontTitle = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 12);

        Font plainFont = new Font(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED),
                10);

        Font boldFont = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 10);

        Font boldItalicFont = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 10);

        Font italicFont = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 10);

        Font italicFontSmall = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 9);

        Phrase phraseStrut = new Phrase(" ");
        phraseStrut.setLeading(leading);

        /*
         * date and time of the meeting
         */
        String meetingDate = sdfDate.format(meeting.getPlannedDate().getTime());

        String meetingTime = sdfTime.format(meeting.getPlannedStart().getTime()) + " - "
                + sdfTime.format(meeting.getPlannedEnd().getTime()) + " ["
                + meeting.getPlannedEnd().getTimeZone().getDisplayName() + "]";
        ;

        /*
         * Base table
         */
        PdfPTable table = new PdfPTable(new float[] { 0.04f, 0.96f });
        table.setWidthPercentage(100);
        table.setSplitRows(false);
        table.getDefaultCell().setBorderWidth(0);
        table.getDefaultCell().setPadding(0);

        /*
         * recipient of the invitation
         */
        PdfPCell cell = new PdfPCell();
        cell.setBorder(0);
        cell.setColspan(2);
        cell.setPadding(padding);

        cell.addElement(phraseStrut);

        PdfPTable tableRecipient = new PdfPTable(2);
        tableRecipient.setWidthPercentage(100);
        tableRecipient.setSplitRows(false);
        tableRecipient.getDefaultCell().setBorderWidth(0);
        tableRecipient.getDefaultCell().setPadding(0);

        PdfPCell cellRecipient = new PdfPCell();
        cellRecipient.setBorder(0);
        cellRecipient.setPadding(0);
        cellRecipient.addElement(new Phrase(translate("To:"), plainFontTitle));
        cellRecipient.addElement(new Phrase(attendee.getName(), boldFontTitle));

        tableRecipient.addCell(cellRecipient);

        PdfPCell cellDate = new PdfPCell(new Phrase(sdfDate.format(new Date().getTime()), plainFont));
        cellDate.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cellDate.setBorder(0);
        cellDate.setPadding(0);
        cellDate.setPaddingTop(7);

        tableRecipient.addCell(cellDate);

        cell.addElement(tableRecipient);

        cell.addElement(phraseStrut);
        cell.addElement(phraseStrut);
        cell.addElement(phraseStrut);

        /*
         * subject
         */
        cell.addElement(new Phrase(translate("Invitation for the Meeting on") + " " + meetingDate,
                boldItalicFontTitle));

        cell.addElement(phraseStrut);

        /*
         * invitation text
         */
        Phrase phrase = new Phrase(
                Data.getInstance().getAppData().getSetting(AppSettingKey.PDF_INVITATION_TEXT), plainFont);
        phrase.setLeading(leading);

        cell.addElement(phrase);

        cell.addElement(phraseStrut);

        table.addCell(cell);

        /*
         * meeting date, time and location
         */
        cell = new PdfPCell(new Phrase(meetingDate, boldItalicFont));
        cell.setBorder(0);
        cell.setColspan(2);
        cell.setPadding(padding);
        cell.setPaddingBottom(0);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);

        table.addCell(cell);

        cell = new PdfPCell(new Phrase(meetingTime, italicFont));
        cell.setBorder(0);
        cell.setColspan(2);
        cell.setPadding(padding);
        cell.setPaddingBottom(0);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);

        table.addCell(cell);

        if (!meeting.getPlannedLocation().equals("")) {
            cell = new PdfPCell(
                    new Phrase(translate("Location") + ": " + meeting.getPlannedLocation(), italicFont));
            cell.setBorder(0);
            cell.setColspan(2);
            cell.setPadding(padding);
            cell.setPaddingBottom(0);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);

            table.addCell(cell);
        }

        /*
         * role; review title and description
         */
        cell = new PdfPCell();
        cell.setBorder(0);
        cell.setColspan(2);
        cell.setPadding(padding);

        cell.addElement(phraseStrut);
        cell.addElement(phraseStrut);

        phrase = new Phrase();
        phrase.setLeading(leading);
        phrase.add(new Chunk(MessageFormat.format(translate("You are invited as {0} to this review ({1})."),
                translate(attendee.getRole().toString()), getReviewTitle()), boldFont));

        cell.addElement(phrase);

        cell.addElement(phraseStrut);

        cell.addElement(new Phrase(resiData.getReview().getDescription(), italicFont));

        cell.addElement(phraseStrut);

        /*
         * Predecessor meeting
         */
        if (meetMgmt.getPredecessorMeeting(meeting) != null) {
            String preMeetingDate = sdfDate
                    .format(meetMgmt.getPredecessorMeeting(meeting).getProtocol().getDate().getTime());

            cell.addElement(new Phrase(MessageFormat
                    .format(translate("This meeting ties up to the review meeting of {0}."), preMeetingDate),
                    plainFont));

            cell.addElement(phraseStrut);
        }

        /*
         * If there is a product name defined
         */
        if (!Data.getInstance().getResiData().getReview().getProduct().getName().trim().equals("")) {
            /*
             * the product of this review
             */
            cell.addElement(new Phrase(translate("The following product will be reviewed:"), plainFont));
            cell.addElement(phraseStrut);

            table.addCell(cell);

            /*
             * Write name and version of the reviewed product
             */
            Phrase phrName = new Phrase(Data.getInstance().getResiData().getReview().getProduct().getName(),
                    boldItalicFont);
            phrName.setLeading(leading);

            PdfPCell cellName = new PdfPCell(phrName);
            cellName.setColspan(2);
            cellName.setBorderWidth(0);
            cellName.setPadding(padding);
            cellName.setPaddingBottom(0);
            cellName.setHorizontalAlignment(Element.ALIGN_CENTER);

            table.addCell(cellName);

            /*
             * If there is a product version defined
             */
            if (!Data.getInstance().getResiData().getReview().getProduct().getVersion().trim().equals("")) {
                Phrase phrVersion = new Phrase(
                        translate("Product Version") + ": "
                                + Data.getInstance().getResiData().getReview().getProduct().getVersion(),
                        italicFont);
                phrVersion.setLeading(leading);

                PdfPCell cellVersion = new PdfPCell(phrVersion);
                cellVersion.setColspan(2);
                cellVersion.setBorderWidth(0);
                cellVersion.setPadding(padding);
                cellVersion.setPaddingBottom(0);
                cellVersion.setHorizontalAlignment(Element.ALIGN_CENTER);

                table.addCell(cellVersion);
            }

            table.addCell(createVerticalStrut(PDFTools.cmToPt(0.7f), 2));
        } else {
            table.addCell(cell);
        }

        boolean showBottomStrut = false;

        /*
         * List point used for lists
         */
        Phrase phraseListPoint = new Phrase("", boldFont);
        phraseListPoint.setLeading(leading);

        PdfPCell cellListPoint = new PdfPCell();
        cellListPoint.addElement(phraseListPoint);
        cellListPoint.setBorderWidth(0);
        cellListPoint.setPadding(padding);
        cellListPoint.setPaddingLeft(padding * 2);
        cellListPoint.setPaddingBottom(0);

        /*
         * Textual references
         */
        for (String ref : Application.getInstance().getReviewMgmt().getProductReferences()) {
            Phrase phraseRef = new Phrase(ref, italicFontSmall);
            phraseRef.setLeading(leading);

            PdfPCell cellRef = new PdfPCell();
            cellRef.addElement(phraseRef);
            cellRef.setBorderWidth(0);
            cellRef.setPadding(padding);
            cellRef.setPaddingBottom(0);

            table.addCell(cellListPoint);

            table.addCell(cellRef);

            showBottomStrut = true;
        }

        /*
         * External file references
         */
        for (File ref : Application.getInstance().getReviewMgmt().getExtProdReferences()) {
            Phrase phraseRef = new Phrase();
            phraseRef.add(new Chunk(ref.getName(), italicFontSmall));
            phraseRef.add(new Chunk(" (" + translate("File Attachment") + ")", italicFontSmall));
            phraseRef.setFont(plainFont);
            phraseRef.setLeading(leading);

            PdfPCell cellRef = new PdfPCell();
            cellRef.addElement(phraseRef);
            cellRef.setBorderWidth(0);
            cellRef.setPadding(padding);
            cellRef.setPaddingBottom(0);

            table.addCell(cellListPoint);

            if (attachProdExtRefs) {
                cellRef.setCellEvent(new PDFCellEventExtRef(pdfWriter, ref));
            }

            table.addCell(cellRef);

            showBottomStrut = true;
        }

        if (showBottomStrut) {
            table.addCell(createVerticalStrut(PDFTools.cmToPt(0.4f), 2));
        }

        /*
         * "please prepare" for the reviwers; on questions ask moderators
         */
        cell = new PdfPCell();
        cell.setBorder(0);
        cell.setColspan(2);
        cell.setPadding(padding);

        phrase = new Phrase();
        phrase.setLeading(leading);

        if (attendee.getAspects() != null) {
            phrase.add(new Chunk(translate(
                    "Please prepare for the review meeting by checking the product for the aspects which are associated to you.")
                    + " ", plainFont));
        }

        List<Attendee> moderators = new ArrayList<Attendee>();
        for (Attendee a : Application.getInstance().getAttendeeMgmt().getAttendees()) {
            if (a.getRole() == Role.MODERATOR) {
                moderators.add(a);
            }
        }

        if (moderators.size() == 1 && attendee.getRole() != Role.MODERATOR) {
            phrase.add(new Chunk(translate(
                    "Please do not hesitate to contact the review moderator if you have any questions:") + " ",
                    plainFont));
        } else if (moderators.size() > 1 && attendee.getRole() != Role.MODERATOR) {
            phrase.add(new Chunk(translate(
                    "Please do not hesitate to contact one of the review moderators if you have any questions:")
                    + " ", plainFont));
        }

        cell.addElement(phrase);

        Phrase phraseStrutSmall = new Phrase(" ");
        phraseStrutSmall.setLeading(leading / 2);

        if (moderators.size() > 0 && attendee.getRole() != Role.MODERATOR) {
            for (Attendee mod : moderators) {
                cell.addElement(phraseStrutSmall);
                cell.addElement(new Phrase(mod.getName(), boldFont));
                cell.addElement(new Phrase(mod.getContact(), italicFont));
            }
        }

        table.addCell(cell);

        pdfDoc.add(table);
    } catch (Exception e) {
        /*
         * Not part of unit testing because this exception is only thrown if
         * an internal error occurs.
         */
        throw new ExportException(translate("Cannot generate front page of the PDF document."));
    }
}