Example usage for com.lowagie.text Font HELVETICA

List of usage examples for com.lowagie.text Font HELVETICA

Introduction

In this page you can find the example usage for com.lowagie.text Font HELVETICA.

Prototype

int HELVETICA

To view the source code for com.lowagie.text Font HELVETICA.

Click Source Link

Document

a possible value of a font family.

Usage

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

License:Open Source License

private void addSummaryOfNeedsDomainRow(PdfPTable summaryOfNeedsTable, int rowNum, List<String> domains,
        List<OcanNeedRatingOverTimeNeedBreakdownBean> ocans,
        OcanNeedRatingOverTimeNeedBreakdownBean lastBreakDownBean) {

    PdfPCell c2 = new PdfPCell();
    c2.setBackgroundColor(Color.BLUE);
    c2.setPhrase(new Phrase(domains.get(rowNum), new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
    summaryOfNeedsTable.addCell(c2);/*www  .j  a  va2  s  .c om*/

    if (lastBreakDownBean != null) {
        boolean checkmark = false;
        if (!ocans.get(0).getNeeds().get(rowNum).getConsumerNeed()
                .equals(lastBreakDownBean.getNeeds().get(rowNum).getConsumerNeed())) {
            checkmark = true;
        }
        if (!ocans.get(0).getNeeds().get(rowNum).getStaffNeed()
                .equals(lastBreakDownBean.getNeeds().get(rowNum).getStaffNeed())) {
            checkmark = true;
        }
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        if (checkmark) {
            c2.setPhrase(new Phrase("X", new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
        }
        summaryOfNeedsTable.addCell(c2);
    }

    if (ocans.size() > 0) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(ocans.get(0).getNeeds().get(rowNum).getConsumerNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(0).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(0).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(ocans.get(0).getNeeds().get(rowNum).getStaffNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(0).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(0).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (ocans.size() > 1) {
        boolean checkmark = false;
        if (!ocans.get(1).getNeeds().get(rowNum).getConsumerNeed()
                .equals((ocans.get(0).getNeeds().get(rowNum).getConsumerNeed()))) {
            checkmark = true;
        }
        if (!ocans.get(1).getNeeds().get(rowNum).getStaffNeed()
                .equals((ocans.get(0).getNeeds().get(rowNum).getStaffNeed()))) {
            checkmark = true;
        }
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        if (checkmark) {
            c2.setPhrase(new Phrase("X", new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
        }
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(ocans.get(1).getNeeds().get(rowNum).getConsumerNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(1).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(1).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(ocans.get(1).getNeeds().get(rowNum).getStaffNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(1).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(1).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (ocans.size() > 2) {
        boolean checkmark = false;
        if (!ocans.get(2).getNeeds().get(rowNum).getConsumerNeed()
                .equals((ocans.get(1).getNeeds().get(rowNum).getConsumerNeed()))) {
            checkmark = true;
        }
        if (!ocans.get(2).getNeeds().get(rowNum).getStaffNeed()
                .equals((ocans.get(1).getNeeds().get(rowNum).getStaffNeed()))) {
            checkmark = true;
        }
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        if (checkmark) {
            c2.setPhrase(new Phrase("X", new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
        }
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(ocans.get(2).getNeeds().get(rowNum).getConsumerNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(2).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(2).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(ocans.get(2).getNeeds().get(rowNum).getStaffNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(2).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(2).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }

}

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

License:Open Source License

private void createOcanEntry(PdfPTable table, SummaryOfActionsAndCommentsOCANBean ocanBean) {
    Font f = new Font(Font.HELVETICA, 12, Font.BOLD, Color.BLACK);
    //header/*from w ww . jav  a2  s .  c  o m*/
    PdfPCell c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    c1.setPhrase(new Phrase("Rating", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(2);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase(ocanBean.getOcanName() + " - " + dateFormatter.format(ocanBean.getOcanDate()), f));
    table.addCell(c1);

    //actions
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setBorderWidthBottom(0);
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("Actions", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(ocanBean.getActions(), normalText));
    table.addCell(c1);

    //By Whom
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setBorderWidthBottom(0);
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("By Whom", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(ocanBean.getByWhom(), normalText));
    table.addCell(c1);

    //review date
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setBorderWidthBottom(0);
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("Review Date", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(ocanBean.getReviewDate(), normalText));
    table.addCell(c1);

    //consumer
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase(convertNeedToWord(ocanBean.getConsumerNeedRating()), boldText));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("Consumer Comments", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(includeComments ? ocanBean.getConsumerComments() : "", normalText));
    table.addCell(c1);

    //staff
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase(convertNeedToWord(ocanBean.getStaffNeedRating()), boldText));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("Staff Comments", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(includeComments ? ocanBean.getStaffComments() : "", normalText));
    table.addCell(c1);
}

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);//from  w w w  . j  a  va 2  s .  c  om
    table.addCell(emptyCell);

    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);/* www.  ja v  a  2s.c  om*/
    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.posterita.core.TabularReport.java

License:Open Source License

public String createPDFReport() throws DocumentException, FileNotFoundException {
    String filename = RandomStringGenerator.randomstring() + ".pdf";
    String filepath = ReportManager.getReportPath(filename);

    FileOutputStream fos = new FileOutputStream(filepath);

    Document document = new Document(PageSize.A4);
    PdfWriter pdfWriter = PdfWriter.getInstance(document, fos);

    document.open();/*ww w. ja v a  2 s .c  o m*/

    Font style1 = new Font(Font.HELVETICA, 16.0f, Font.BOLD);
    Font style2 = new Font(Font.HELVETICA, 12.0f);
    //write content
    Paragraph p = new Paragraph(new Chunk(title, style1));
    p.setAlignment(Element.ALIGN_CENTER);
    document.add(p);

    p = new Paragraph(new Chunk(subtitle, style2));
    p.setAlignment(Element.ALIGN_CENTER);
    document.add(p);

    p = new Paragraph("\n\n");
    document.add(p);

    Object[] headers = reportData.get(0);

    PdfPTable table = new PdfPTable(headers.length);
    for (Object[] row : reportData) {
        for (Object data : row) {
            PdfPCell cell = new PdfPCell(new Phrase(data.toString()));
            table.addCell(cell);
        }
    }

    document.add(table);
    document.close();

    return filename;
}

From source file:org.posterita.core.TabularReport2.java

License:Open Source License

public String createPDFReport() throws DocumentException, FileNotFoundException {
    String filename = RandomStringGenerator.randomstring() + ".pdf";
    String filepath = ReportManager.getReportPath(filename);

    FileOutputStream fos = new FileOutputStream(filepath);

    Document document = new Document(PageSize.A4.rotate());
    PdfWriter pdfWriter = PdfWriter.getInstance(document, fos);

    document.open();// ww w.  j  a  v a  2s.c  o m

    Font style1 = new Font(Font.HELVETICA, 16.0f, Font.BOLD);
    Font style2 = new Font(Font.HELVETICA, 14.0f);
    Font style3 = new Font(Font.HELVETICA, 10.0f);

    //write content
    Paragraph p = new Paragraph(new Chunk(title, style1));
    p.setAlignment(Element.ALIGN_CENTER);
    document.add(p);

    p = new Paragraph(new Chunk(subtitle, style2));
    p.setAlignment(Element.ALIGN_CENTER);
    document.add(p);

    p = new Paragraph("\n\n");
    document.add(p);

    Object[] headers = reportData.get(0);

    PdfPTable table = new PdfPTable(headers.length);
    table.setWidthPercentage(100.0f);

    //int[] widths = new int[]{1,2,1,4};
    //table.setWidths(widths);

    for (Object[] row : reportData) {
        for (Object data : row) {
            PdfPCell cell = new PdfPCell(new Phrase(data.toString(), style3));
            table.addCell(cell);
        }
    }

    document.add(table);
    document.close();

    return filename;
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Paragraph filterDescription(String text) {
    Paragraph para = new Paragraph(text);
    para.setFont(new Font(Font.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 0)));
    return para;//  w ww .  j  av a2  s  .c  o  m
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Cell columnHeaderCell(String label, boolean leaf, int hAlign) throws BadElementException {
    Paragraph para = new Paragraph(label);
    para.setFont(new Font(Font.HELVETICA, 10, Font.NORMAL, Color.WHITE));

    Cell cell = new Cell();
    cell.addElement(para);//from  w ww.  j  ava2  s . co  m
    cell.setHorizontalAlignment(hAlign);
    cell.setHeader(true);
    cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
    cell.setBackgroundColor(new Color(55, 96, 145));

    cell.setBorderWidth(0);

    return cell;
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

/**
 * Renders a Cell for/*from  w ww.j a  v a2s .c om*/
 *
 * @param label
 * @param header
 * @param depth
 * @param leaf
 * @param horizantalAlignment
 * @return
 * @throws BadElementException
 */
public static Cell bodyCell(String label, boolean header, int depth, boolean leaf, int horizantalAlignment)
        throws BadElementException {

    Cell cell = new Cell();
    cell.setHorizontalAlignment(horizantalAlignment);

    if (label != null) {
        Paragraph para = new Paragraph(label);
        Font font = new Font(Font.HELVETICA, 10, Font.NORMAL, Color.BLACK);
        if (depth == 0 && !leaf) {
            font.setColor(Color.WHITE);
        }
        para.setFont(font);
        para.setIndentationLeft(5.4f + (header ? 12 * depth : 0));
        cell.addElement(para);
    }

    cell.setBorderWidthLeft(0f);
    cell.setBorderWidthRight(0);
    cell.setBorderWidthTop(0);

    if (!leaf && depth == 0) {
        cell.setBackgroundColor(new Color(149, 179, 215)); // #95B3D7
        cell.setBorderWidthBottom(0.5f);
        cell.setBorderColorBottom(new Color(219, 229, 241)); // #DBE5F1
    } else if (!leaf && depth == 1) {
        cell.setBackgroundColor(new Color(219, 229, 241));
        cell.setBorderWidthBottom(0.5f);
        cell.setBorderColorBottom(new Color(79, 129, 189));
    } else {
        cell.setBorderWidthBottom(0.5f);
        cell.setBorderColorBottom(new Color(219, 229, 241));
        cell.setBorderWidthTop(0.5f);
        cell.setBorderColorTop(new Color(219, 229, 241));
    }

    return cell;
}

From source file:org.silverpeas.components.almanach.control.AlmanachPdfGenerator.java

License:Open Source License

static public void buildPdf(String name, AlmanachSessionController almanach, String mode)
        throws AlmanachRuntimeException {
    try {/*from w w  w . j  av a 2s  . c  o  m*/

        String fileName = FileRepositoryManager.getTemporaryPath(almanach.getSpaceId(),
                almanach.getComponentId()) + name;
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);

        // we add some meta information to the document
        document.addAuthor(almanach.getSettings().getString("author", ""));
        document.addSubject(almanach.getSettings().getString("subject", ""));
        document.addCreationDate();

        PdfWriter.getInstance(document, new FileOutputStream(fileName));
        document.open();

        try {
            Calendar currentDay = Calendar.getInstance();
            currentDay.setTime(almanach.getCurrentDay());
            String sHeader = almanach.getString("events");
            if (mode.equals(PDF_MONTH_ALLDAYS) || mode.equals(PDF_MONTH_EVENTSONLY)) {
                sHeader += " " + almanach.getString("GML.mois" + currentDay.get(Calendar.MONTH));
            }
            sHeader += " " + currentDay.get(Calendar.YEAR);
            HeaderFooter header = new HeaderFooter(new Phrase(sHeader), false);
            HeaderFooter footer = new HeaderFooter(new Phrase("Page "), true);
            footer.setAlignment(Element.ALIGN_CENTER);

            document.setHeader(header);
            document.setFooter(footer);

            createFirstPage(almanach, document);
            document.newPage();

            Font titleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, new Color(255, 255, 255));
            Paragraph cTitle = new Paragraph(almanach.getString("Almanach") + " "
                    + almanach.getString("GML.mois" + currentDay.get(Calendar.MONTH)) + " "
                    + currentDay.get(Calendar.YEAR), titleFont);
            Chapter chapter = new Chapter(cTitle, 1);

            // Collection<EventDetail> events =
            // almanach.getListRecurrentEvent(mode.equals(PDF_YEAR_EVENTSONLY));
            AlmanachCalendarView almanachView;
            if (PDF_YEAR_EVENTSONLY.equals(mode)) {
                almanachView = almanach.getYearlyAlmanachCalendarView();
            } else {
                almanachView = almanach.getMonthlyAlmanachCalendarView();
            }

            List<DisplayableEventOccurrence> occurrences = almanachView.getEvents();
            generateAlmanach(chapter, almanach, occurrences, mode);

            document.add(chapter);
        } catch (Exception ex) {
            throw new AlmanachRuntimeException("PdfGenerator.generate", AlmanachRuntimeException.WARNING,
                    "AlmanachRuntimeException.EX_PROBLEM_TO_GENERATE_PDF", ex);
        }

        document.close();

    } catch (Exception e) {
        throw new AlmanachRuntimeException("PdfGenerator.generate", AlmanachRuntimeException.WARNING,
                "AlmanachRuntimeException.EX_PROBLEM_TO_GENERATE_PDF", e);
    }

}