Example usage for com.lowagie.text Paragraph add

List of usage examples for com.lowagie.text Paragraph add

Introduction

In this page you can find the example usage for com.lowagie.text Paragraph add.

Prototype

public boolean add(Object o) 

Source Link

Document

Adds an Object to the Paragraph.

Usage

From source file:org.cgiar.ccafs.ap.summaries.projects.pdf.ProjectSummaryPDF.java

License:Open Source License

/**
 * Entering the project title in the summary
 *///from w w w.java  2s .  c  om
private void addProjectTitle() {
    LineSeparator line = new LineSeparator(1, 100, null, Element.ALIGN_CENTER, -7);
    Paragraph paragraph = new Paragraph();
    line.setLineColor(titleColor);
    try {
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        paragraph.setFont(BODY_TEXT_BOLD_FONT);
        paragraph.add("Title: ");
        paragraph.setFont(BODY_TEXT_FONT);
        paragraph.add(this.messageReturn(project.getTitle()));
        paragraph.add(line);
        document.add(paragraph);
        document.add(Chunk.NEWLINE);
        ;
    } catch (DocumentException e) {
        LOG.error("There was an error trying to add the project title to the project summary pdf", e);
    }
}

From source file:org.cgiar.ccafs.ap.summaries.projects.pdf.ProjectSummaryPDF.java

License:Open Source License

/**
 * Method used for to add the project summary
 *///from   w  ww .  j  av  a  2  s. co  m
private void addSummary() {
    Paragraph paragraph = new Paragraph();
    paragraph.setAlignment(Element.ALIGN_LEFT);
    try {
        Phrase title = new Phrase(this.getText("summaries.project.summary"), BODY_TEXT_BOLD_FONT);
        paragraph.add(title);
        document.add(paragraph);

        paragraph = new Paragraph();
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        Phrase body = new Phrase(this.messageReturn(project.getSummary()), BODY_TEXT_FONT);
        paragraph.add(body);

        document.add(paragraph);

    } catch (DocumentException e) {
        LOG.error("There was an error trying to add the project summary to the project summary pdf", e);
    }
}

From source file:org.esa.nest.dat.reports.PDFFormat.java

License:Open Source License

private static void addTitlePage(Document document) throws DocumentException {
    Paragraph preface = new Paragraph();
    // We add one empty line
    addEmptyLine(preface, 1);//  w  w w  . j  a  va  2  s.c o  m
    // Lets write a big header
    preface.add(new Paragraph("Title of the document", catFont));

    addEmptyLine(preface, 1);
    // Will create: Report generated by: _name, _date
    preface.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            smallBold));
    addEmptyLine(preface, 3);
    preface.add(new Paragraph("This document describes something which is very important ", smallBold));

    addEmptyLine(preface, 8);

    preface.add(new Paragraph(
            "This document is a preliminary version and not subject to your license agreement or any other agreement with vogella.com ;-).",
            redFont));

    document.add(preface);
    // Start a new page
    document.newPage();
}

From source file:org.gbif.ipt.task.Eml2Rtf.java

License:Apache License

/**
 * Add abstract section. This corresponds to resource's description.
 * /*from  w w  w.j  ava 2 s . c  om*/
 * @param doc Document
 * @param eml EML
 * @throws DocumentException if problem occurs during add
 */
private void addAbstract(Document doc, Eml eml) throws DocumentException {
    if (exists(eml.getDescription())) {
        Paragraph p = new Paragraph();
        p.setAlignment(Element.ALIGN_JUSTIFIED);
        p.setFont(font);
        p.add(new Phrase(getText("rtf.abstract"), fontTitle));
        p.add(Chunk.NEWLINE);
        p.add(Chunk.NEWLINE);
        p.add(eml.getDescription().replace("\r\n", "\n"));
        p.add(Chunk.NEWLINE);
        doc.add(p);
        p.clear();
    }
}

From source file:org.gbif.ipt.task.Eml2Rtf.java

License:Apache License

/**
 * Add "Resumen" section. This corresponds to resource's description.
 * /* w w w . jav a  2 s  . c  om*/
 * @param doc Document
 * @throws DocumentException if problem occurs during add
 */
private void addRes(Document doc) throws DocumentException {
    if (exists(this.resu)) {
        Paragraph p = new Paragraph();
        p.setAlignment(Element.ALIGN_JUSTIFIED);
        p.setFont(font);
        p.add(new Phrase(getText("rtf.abstract.res"), fontTitle));
        p.add(Chunk.NEWLINE);
        p.add(Chunk.NEWLINE);
        p.add(this.resu);
        p.add(Chunk.NEWLINE);
        doc.add(p);
        p.clear();
    }
}

From source file:org.gbif.ipt.task.Eml2Rtf.java

License:Apache License

/**
 * Add "Abstract" section. This corresponds to resource's description.
 * /*from  ww  w . j  ava  2  s. com*/
 * @param doc Document
 * @throws DocumentException if problem occurs during add
 */
private void addAbs(Document doc) throws DocumentException {
    if (exists(this.abst)) {
        Paragraph p = new Paragraph();
        p.setAlignment(Element.ALIGN_JUSTIFIED);
        p.setFont(font);
        p.add(new Phrase(getText("rtf.abstract.abst"), fontTitle));
        p.add(Chunk.NEWLINE);
        p.add(Chunk.NEWLINE);
        p.add(this.abst);
        p.add(Chunk.NEWLINE);
        doc.add(p);
        p.clear();
    }
}

From source file:org.gbif.ipt.task.Eml2Rtf.java

License:Apache License

/**
 * Add (Palabras claves) keywords section.
 * //from  w ww  .jav a2s .c  o  m
 * @param doc Document
 * @throws DocumentException if problem occurs during add
 */
private void addPalcla(Document doc) throws DocumentException {
    if (this.palcla != null && !(this.palcla.length() == 0)) {
        Paragraph p = new Paragraph();
        p.setAlignment(Element.ALIGN_JUSTIFIED);
        p.setFont(font);
        p.add(new Phrase(getText("rtf.keywords.palcla") + ". ", fontTitle));
        p.add(this.palcla);
        p.add(Chunk.NEWLINE);
        doc.add(p);
        p.clear();
    }
}

From source file:org.gbif.ipt.task.Eml2Rtf.java

License:Apache License

/**
 * Add (keywords) keywords section./*w w  w  .j a v a  2 s  . c om*/
 * 
 * @param doc Document
 * @throws DocumentException if problem occurs during add
 */
private void addKeyWord(Document doc) throws DocumentException {
    if (this.keywor != null && !(this.keywor.length() == 0)) {
        Paragraph p = new Paragraph();
        p.setAlignment(Element.ALIGN_JUSTIFIED);
        p.setFont(font);
        p.add(new Phrase(getText("rtf.keywords.keywor") + ". ", fontTitle));
        p.add(this.keywor);
        p.add(Chunk.NEWLINE);
        doc.add(p);
        p.clear();
    }
}

From source file:org.gbif.ipt.task.Eml2Rtf.java

License:Apache License

/**
 * Add "Discusion" section. /*  w  ww.  j  a v a 2s.c  o m*/
 * 
 * @param doc Document
 * @throws DocumentException if problem occurs during add
 */
private void addDiscu(Document doc) throws DocumentException {
    if (exists(this.discu)) {
        Paragraph p = new Paragraph();
        p.setAlignment(Element.ALIGN_JUSTIFIED);
        p.setFont(font);
        p.add(new Phrase(getText("rtf.discu"), fontTitle));
        p.add(Chunk.NEWLINE);
        p.add(this.discu);
        p.add(Chunk.NEWLINE);
        doc.add(p);
        p.clear();
    }
}

From source file:org.gbif.ipt.task.Eml2Rtf.java

License:Apache License

/**
 * Add "Agradecimientos" section. //ww w . j a va2s .co m
 * 
 * @param doc Document
 * @throws DocumentException if problem occurs during add
 */
private void addAgrad(Document doc) throws DocumentException {
    if (exists(this.agrad)) {
        Paragraph p = new Paragraph();
        p.setAlignment(Element.ALIGN_JUSTIFIED);
        p.setFont(font);
        p.add(new Phrase(getText("rtf.agrad"), fontTitle));
        p.add(Chunk.NEWLINE);
        p.add(this.agrad);
        p.add(Chunk.NEWLINE);
        doc.add(p);
        p.clear();
    }
}