Search in sources :

Example 41 with Paragraph

use of com.lowagie.text.Paragraph in project vcell by virtualcell.

the class ITextWriter method createCell.

protected Cell createCell(String text, Font font, int colspan, int borderWidth, int alignment, boolean isHeader) throws DocumentException {
    Cell cell = new Cell(new Paragraph(text, font));
    cell.setBorderWidth(borderWidth);
    cell.setHorizontalAlignment(alignment);
    if (colspan > 1) {
        cell.setColspan(colspan);
    }
    if (isHeader) {
        cell.setHeader(true);
    }
    return (cell);
}
Also used : Cell(com.lowagie.text.Cell) Paragraph(com.lowagie.text.Paragraph)

Example 42 with Paragraph

use of com.lowagie.text.Paragraph in project drools by kiegroup.

the class EndPage method newRulePage.

public static void newRulePage(Document document, String packageName, DrlRuleParser drlData) throws DocumentException {
    document.add(new Paragraph(packageName, PACKAGE_NAME));
    document.add(new Paragraph("Rule " + drlData.getName(), CHAPTER_TITLE));
    // Extends
    int index = drlData.getName().lastIndexOf("extends");
    if (index > 0) {
        document.add(new Paragraph("Extends:", BODY_TEXT));
        Paragraph ext = new Paragraph(drlData.getName().substring("extends".length() + index), BODY_TEXT);
        ext.setIndentationLeft(INDENTATION_LEFT);
        document.add(ext);
    }
    // if the data came from guvnor, this will be empty
    if (drlData.getDescription() != null && drlData.getDescription().trim().equals("")) {
        Iterator<String> iter = drlData.getMetadata().iterator();
        while (iter.hasNext()) {
            String nextDesc = iter.next();
            if (nextDesc.startsWith("Description")) {
                String[] parts = splitFirst(nextDesc, ":");
                // no description
                if (parts.length == 1) {
                    // guvnor did not have it
                    document.add(newDescription(drlData.getDescription()));
                } else {
                    document.add(newDescription(parts[1]));
                }
            }
        }
    } else {
        document.add(newDescription(drlData.getDescription()));
    }
    // DRL
    document.add(newRuleTable(drlData));
    // Meta data
    document.add(newTable("Metadata", drlData.getMetadata()));
    // Other
    createOtherItems(document, drlData.getOtherInformation());
    document.newPage();
}
Also used : Paragraph(com.lowagie.text.Paragraph)

Example 43 with Paragraph

use of com.lowagie.text.Paragraph in project charts by vaadin.

the class PdfExportDemo method writePdfContent.

private void writePdfContent() throws DocumentException, IOException {
    Paragraph caption = new Paragraph();
    caption.add(new Chunk("Vaadin Charts Export Demo PDF", captionFont));
    document.add(caption);
    Paragraph br = new Paragraph(Chunk.NEWLINE);
    document.add(br);
    Paragraph paragraph = new Paragraph();
    paragraph.add(new Chunk("This PDF is rendered with iText 2.1.7.", normalFont));
    document.add(paragraph);
    paragraph = new Paragraph();
    paragraph.add(new Chunk("Chart below is originally an SVG image created with Vaadin Charts and rendered with help of Batik SVG Toolkit.", normalFont));
    document.add(paragraph);
    document.add(createSvgImage(writer.getDirectContent(), 400, 400));
    document.add(createExampleTable());
}
Also used : Chunk(com.lowagie.text.Chunk) Paragraph(com.lowagie.text.Paragraph)

Aggregations

Paragraph (com.lowagie.text.Paragraph)43 Font (com.lowagie.text.Font)14 DocumentException (com.lowagie.text.DocumentException)13 Color (java.awt.Color)13 Document (com.lowagie.text.Document)12 Chunk (com.lowagie.text.Chunk)11 Cell (com.lowagie.text.Cell)9 Phrase (com.lowagie.text.Phrase)7 Section (com.lowagie.text.Section)7 PdfPCell (com.lowagie.text.pdf.PdfPCell)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 List (java.util.List)7 ArrayList (java.util.ArrayList)6 Table (com.lowagie.text.Table)5 DiscrepancyNoteBean (org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean)5 ListItem (com.lowagie.text.ListItem)4 PdfPTable (com.lowagie.text.pdf.PdfPTable)4 IOException (java.io.IOException)4 ServletOutputStream (javax.servlet.ServletOutputStream)4 ExpressionException (cbit.vcell.parser.ExpressionException)3