Search in sources :

Example 11 with Font

use of com.lowagie.text.Font in project activityinfo by bedatadriven.

the class ThemeHelper method legendTitle.

public static Paragraph legendTitle(String title) {
    Paragraph para = new Paragraph(title);
    para.setFont(new Font(Font.TIMES_ROMAN, BODY_FONT_SIZE, Font.BOLD, BLUE2));
    para.setSpacingBefore(BODY_FONT_SIZE);
    return para;
}
Also used : Font(com.lowagie.text.Font) Paragraph(com.lowagie.text.Paragraph)

Example 12 with Font

use of com.lowagie.text.Font in project activityinfo by bedatadriven.

the class ThemeHelper method reportTitle.

public static Paragraph reportTitle(String title) {
    Paragraph para = new Paragraph(title);
    para.setFont(new Font(Font.TIMES_ROMAN, TITLE_FONT_SIZE, Font.NORMAL, BLUE));
    para.setSpacingAfter(15);
    return para;
}
Also used : Font(com.lowagie.text.Font) Paragraph(com.lowagie.text.Paragraph)

Example 13 with Font

use of com.lowagie.text.Font in project activityinfo by bedatadriven.

the class ThemeHelper method bodyCell.

/**
 * Renders a Cell for
 *
 * @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 = bodyFont();
        if (depth == 0 && !leaf) {
            font.setColor(Color.WHITE);
        }
        para.setFont(font);
        para.setIndentationLeft(LEFT_INDENT + (header ? HEADER3_FONT_SIZE * depth : 0));
        cell.addElement(para);
    }
    cell.setBorderWidthLeft(0f);
    cell.setBorderWidthRight(0);
    cell.setBorderWidthTop(0);
    if (!leaf && depth == 0) {
        // #95B3D7
        cell.setBackgroundColor(BLUE4);
        cell.setBorderWidthBottom(THIN_BORDER_WIDTH);
        // #DBE5F1
        cell.setBorderColorBottom(BLUE5);
    } else if (!leaf && depth == 1) {
        cell.setBackgroundColor(BLUE5);
        cell.setBorderWidthBottom(THIN_BORDER_WIDTH);
        cell.setBorderColorBottom(BLUE2);
    } else {
        cell.setBorderWidthBottom(THIN_BORDER_WIDTH);
        cell.setBorderColorBottom(BLUE5);
        cell.setBorderWidthTop(THIN_BORDER_WIDTH);
        cell.setBorderColorTop(BLUE5);
    }
    return cell;
}
Also used : Cell(com.lowagie.text.Cell) Font(com.lowagie.text.Font) Paragraph(com.lowagie.text.Paragraph)

Example 14 with Font

use of com.lowagie.text.Font in project dhis2-core by dhis2.

the class PdfFormFontSettings method createFont.

private Font createFont(int fontType) {
    Font font = new Font();
    font.setFamily(FONTFAMILY);
    switch(fontType) {
        case FONTTYPE_BODY:
            font.setSize(FONTSIZE_BODY);
            font.setColor(Color.BLACK);
            break;
        case FONTTYPE_TITLE:
            font.setSize(FONTSIZE_TITLE);
            font.setStyle(java.awt.Font.BOLD);
            // Navy Color
            font.setColor(new Color(0, 0, 128));
            break;
        case FONTTYPE_DESCRIPTION:
            font.setSize(FONTSIZE_DESCRIPTION);
            font.setColor(Color.DARK_GRAY);
            break;
        case FONTTYPE_SECTIONHEADER:
            font.setSize(FONTSIZE_SECTIONHEADER);
            font.setStyle(java.awt.Font.BOLD);
            // Steel Blue Color
            font.setColor(new Color(70, 130, 180));
            break;
        case FONTTYPE_FOOTER:
            font.setSize(FONTSIZE_FOOTER);
            break;
        default:
            font.setSize(FONTSIZE_BODY);
            break;
    }
    return font;
}
Also used : Font(com.lowagie.text.Font)

Example 15 with Font

use of com.lowagie.text.Font in project OpenClinica by OpenClinica.

the class DownloadDiscrepancyNote method serializeThreadsToPDF.

public void serializeThreadsToPDF(List<DiscrepancyNoteThread> listOfThreads, OutputStream stream, String studyIdentifier) {
    ServletOutputStream servletStream = (ServletOutputStream) stream;
    Document pdfDoc = new Document();
    try {
        PdfWriter.getInstance(pdfDoc, servletStream);
        pdfDoc.open();
        // Create header for the study identifier or name
        if (studyIdentifier != null) {
            HeaderFooter header = new HeaderFooter(new Phrase("Study Identifier: " + studyIdentifier + " pg."), true);
            header.setAlignment(Element.ALIGN_CENTER);
            Paragraph para = new Paragraph("Study Identifier: " + studyIdentifier, new Font(Font.HELVETICA, 18, Font.BOLD, new Color(0, 0, 0)));
            para.setAlignment(Element.ALIGN_CENTER);
            pdfDoc.setHeader(header);
            pdfDoc.add(para);
        }
        for (DiscrepancyNoteThread discNoteThread : listOfThreads) {
            pdfDoc.add(this.createTableThreadHeader(discNoteThread));
            // Just the parent of the thread?  discNoteThread.getLinkedNoteList()
            for (DiscrepancyNoteBean discNoteBean : discNoteThread.getLinkedNoteList()) {
                // DiscrepancyNoteBean discNoteBean = discNoteThread.getLinkedNoteList().getFirst();
                if (discNoteBean.getParentDnId() > 0) {
                    pdfDoc.add(this.createTableFromBean(discNoteBean));
                    pdfDoc.add(new Paragraph("\n"));
                }
            }
        }
    // pdfDoc.add(new Paragraph(content));
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    pdfDoc.close();
}
Also used : ServletOutputStream(javax.servlet.ServletOutputStream) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) Color(java.awt.Color) DocumentException(com.lowagie.text.DocumentException) HeaderFooter(com.lowagie.text.HeaderFooter) Phrase(com.lowagie.text.Phrase) Document(com.lowagie.text.Document) Font(com.lowagie.text.Font) Paragraph(com.lowagie.text.Paragraph) DiscrepancyNoteThread(org.akaza.openclinica.service.DiscrepancyNoteThread)

Aggregations

Font (com.lowagie.text.Font)18 Paragraph (com.lowagie.text.Paragraph)14 Color (java.awt.Color)9 Cell (com.lowagie.text.Cell)6 DocumentException (com.lowagie.text.DocumentException)6 DiscrepancyNoteBean (org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean)4 ExpressionException (cbit.vcell.parser.ExpressionException)3 Chunk (com.lowagie.text.Chunk)3 Document (com.lowagie.text.Document)3 BaseFont (com.lowagie.text.pdf.BaseFont)3 HeaderFooter (com.lowagie.text.HeaderFooter)2 Phrase (com.lowagie.text.Phrase)2 Table (com.lowagie.text.Table)2 ServletOutputStream (javax.servlet.ServletOutputStream)2 Feature (cbit.vcell.model.Feature)1 Membrane (cbit.vcell.model.Membrane)1 StructureTopology (cbit.vcell.model.Model.StructureTopology)1 DocxTable (com.centurylink.mdw.designer.utils.DocxBuilder.DocxTable)1 BadElementException (com.lowagie.text.BadElementException)1 ListItem (com.lowagie.text.ListItem)1