Example usage for com.lowagie.text Paragraph setSpacingAfter

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

Introduction

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

Prototype

public void setSpacingAfter(float spacing) 

Source Link

Document

Sets the spacing after this paragraph.

Usage

From source file:pl.exsio.ca.app.report.terraincard.view.TerrainCardsView.java

License:Open Source License

private Cell getColumnTitleCell(String title) throws Exception {

    Paragraph p = new Paragraph(title, this.getFont());
    p.getFont().setSize(10);//from  w w w  .ja va  2  s. c  om
    p.getFont().setStyle(Font.BOLDITALIC);
    p.setSpacingAfter(2);
    p.setSpacingBefore(2);
    Cell cell = new Cell(p);
    cell.setColspan(2);
    cell.setBackgroundColor(new Color(230, 230, 230));
    return cell;
}

From source file:pl.exsio.ca.app.report.terraincard.view.TerrainCardsView.java

License:Open Source License

private Cell getColumnDescCell(String desc) throws Exception {
    Paragraph p = new Paragraph(t(desc), this.getFont());
    p.getFont().setSize(8);//from ww w. j  a  va  2s .c  o m
    p.getFont().setStyle(Font.BOLDITALIC);
    p.setSpacingAfter(2);
    p.setSpacingBefore(2);
    Cell cell = new Cell(p);
    cell.setBackgroundColor(new Color(230, 230, 230));
    return cell;
}

From source file:pruebareportes.ReporteUtil.java

public static Paragraph darEspaciado(int espacio) {
    Paragraph parrafoEspacio = new Paragraph();
    parrafoEspacio.setSpacingAfter(espacio);
    return parrafoEspacio;
}

From source file:questions.separators.StarSeparators.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from   ww  w  . j  a  v  a2 s.c om*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT));
        document.open();

        Paragraph stars = new Paragraph(20);
        stars.add(new Chunk(new StarSeparators()));
        stars.setSpacingAfter(30);

        ColumnText column = new ColumnText(writer.getDirectContent());
        for (int i = 0; i < 5; i++) {
            column.addElement(TEXT);
            column.addElement(stars);
        }
        column.setSimpleColumn(36, 36, 295, 806);
        column.go();
        column.setSimpleColumn(300, 36, 559, 806);
        column.go();
        document.newPage();

        for (int i = 0; i < 50; i++) {
            document.add(TEXT);
            document.add(stars);
        }
        document.close();
    } catch (Exception de) {
        de.printStackTrace();
    }
}

From source file:test.itext.html.AimsPdf.java

License:Open Source License

public static void addScreenShorts(Document doc, String text)
        throws BadElementException, IOException, DocumentException {

    Paragraph heading = new Paragraph("Screenshots",
            FontFactory.getFont("arial", 10, Font.UNDERLINE | Font.BOLDITALIC));
    heading.setSpacingAfter(12f);
    doc.add(heading);/* w w w .  j av  a 2 s  . c  o m*/

    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(80);
    table.setHorizontalAlignment(Element.ALIGN_CENTER);

    Image image = Image.getInstance("screen_shoot1.gif");
    image.scalePercent(70);
    PdfPCell cell = new PdfPCell(image);
    cell.setPadding(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    image = Image.getInstance("screen_shoot2.gif");
    image.scalePercent(70);
    cell = new PdfPCell(image);
    cell.setPadding(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    image = Image.getInstance("screen_shoot3.gif");
    image.scalePercent(70);
    cell = new PdfPCell(image);
    cell.setPadding(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    image = Image.getInstance("screen_shoot4.gif");
    image.scalePercent(70);
    cell = new PdfPCell(image);
    cell.setPadding(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    image = Image.getInstance("screen_shoot5.gif");
    image.scalePercent(70);
    cell = new PdfPCell(image);
    cell.setPadding(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    image = Image.getInstance("screen_shoot6.gif");
    image.scalePercent(70);
    cell = new PdfPCell(image);
    cell.setPadding(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    //      doc.add(new Paragraph("\n"));
    doc.add(table);
}

From source file:test.itext.html.AimsPdf.java

License:Open Source License

private static void writeData(Document doc, StringBuffer sb, String headingText)
        throws IOException, DocumentException {
    String data = Utility.replace(sb.toString(), "<p>&nbsp;</p>", "", Utility.REPLACE_ALL);
    data = Utility.replace(data, "</p>", "</p><br/>", Utility.REPLACE_ALL);
    data = Utility.replace(data, "</ul>", "</ul><br/>", Utility.REPLACE_ALL);
    data = Utility.replace(data, "</p><br/></td>", "</p></td>", Utility.REPLACE_ALL);

    System.out.println(data);//w  w w .j ava  2  s .c  o  m
    Reader reader = new StringReader("<root>" + data + "</root>");

    if (headingText != null && headingText.length() > 0) {
        Paragraph heading = new Paragraph(headingText,
                FontFactory.getFont("arial", 10, Font.UNDERLINE | Font.BOLDITALIC));
        heading.setSpacingAfter(12f);
        doc.add(heading);
    }

    ArrayList objects = HTMLWorker.parseToList(reader, style, null);
    for (int k = 0; k < objects.size(); ++k) {
        Element ele = (Element) objects.get(k);
        doc.add(ele);
    }

    reader.close();
}

From source file:tufts.vue.PresentationNotes.java

License:Educational Community License

public static void createOutline(File file) {
    //page size notes:
    //martin-top,left,right,bottom = 36
    //widht :612/* ww w .j  a v  a2  s  .  c o  m*/
    //height : 792
    //usable space 540 x 720
    // step 1: creation of a document-object               
    Document document = new Document(PageSize.LETTER);

    try {
        GUI.activateWaitCursor();
        // step 2:
        // we create a writer that listens to the document
        // and directs a PDF-stream to a file            
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
        //  writer.setDefaultColorspace(PdfName.DEFAULTRGB, null);
        // writer.setStrictImageSequence(true);

        // step 3: we open the document
        document.open();

        Paragraph p1 = new Paragraph(VUE.getActivePathway().getLabel());
        p1.setSpacingAfter(15.0f);
        Font f = p1.getFont();
        f.setStyle(Font.BOLD);
        p1.setFont(f);
        document.add(p1);

        /*p1.add("The leading of this paragraph is calculated automagically. ");
        p1.add("The default leading is 1.5 times the fontsize. ");
        p1.add(new Chunk("You can add chunks "));
        p1.add(new Phrase("or you can add phrases. "));
        p1.add(new Phrase(
           */
        int entryCount = 1;
        int currentIndex = VUE.getActivePathway().getIndex();

        VUE.getActivePathway().setIndex(-1);
        for (LWPathway.Entry entry : VUE.getActivePathway().getEntries()) {

            String notes = entry.getNotes();
            Paragraph p = new Paragraph(entryCount + ".  " + entry.getLabel());
            f = p.getFont();
            f.setStyle(Font.BOLD);
            p.setFont(f);
            Paragraph notesP = new Paragraph(notes);
            notesP.setIndentationLeft(15.0f);
            notesP.setSpacingAfter(15.0f);
            document.add(p);
            document.add(notesP);

            entryCount++;
        }
        VUE.getActivePathway().setIndex(currentIndex);
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    } finally {
        GUI.clearWaitCursor();
    }
    // step 5: we close the document
    document.close();

}

From source file:tufts.vue.PresentationNotes.java

License:Educational Community License

public static void createNodeOutline(File file) {
    //page size notes:
    //martin-top,left,right,bottom = 36
    //widht :612/*  w  w w  .  j ava2s  . co  m*/
    //height : 792
    //usable space 540 x 720
    // step 1: creation of a document-object               
    Document document = new Document(PageSize.LETTER);

    try {
        GUI.activateWaitCursor();
        // step 2:
        // we create a writer that listens to the document
        // and directs a PDF-stream to a file            
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
        //  writer.setDefaultColorspace(PdfName.DEFAULTRGB, null);
        // writer.setStrictImageSequence(true);

        // step 3: we open the document
        document.open();

        Paragraph p1 = new Paragraph(VUE.getActiveMap().getLabel());

        p1.setSpacingAfter(15.0f);
        Font f = p1.getFont();
        f.setStyle(Font.BOLD);
        f.setSize(18f);
        p1.setFont(f);
        document.add(p1);

        String n2 = VUE.getActiveMap().getNotes();
        if (n2 != null && n2.length() > 0) {
            Paragraph p2 = new Paragraph(n2);
            p2.setIndentationLeft(30.0f);
            p2.setSpacingAfter(15.0f);
            //   f = p2.getFont();
            //f.setSize(f.getSize()-2);
            //p2.setFont(f);
            document.add(p2);
        }

        int entryCount = 1;
        float indentation = 0.0f;
        Iterator it = VUE.getActiveMap().getAllDescendents(LWComponent.ChildKind.PROPER).iterator();

        while (it.hasNext()) {
            LWComponent c = (LWComponent) it.next();
            if (c instanceof LWNode) {
                LWNode n = (LWNode) c;
                outlineChildNode(document, indentation, n, entryCount);
                entryCount++;
                iterateChildren(document, indentation + 10, n, 1);
            }

        }

        it = VUE.getActiveMap().getAllDescendents(LWComponent.ChildKind.PROPER).iterator();
        while (it.hasNext()) {
            LWComponent c = (LWComponent) it.next();
            if (c instanceof LWLink) {
                LWLink l = (LWLink) c;
                String notes = l.getNotes();
                String linkLabel = l.getLabel();

                if ((notes == null || notes.length() == 0) && (linkLabel == null || linkLabel.length() == 0))
                    continue;

                if (linkLabel == null || linkLabel.length() == 0)
                    linkLabel = "Link";

                Paragraph p = new Paragraph(entryCount + ".  " + linkLabel.replaceAll("\\n", ""));
                f = p.getFont();
                f.setStyle(Font.BOLD);
                f.setSize(14f);
                p.setFont(f);
                Paragraph notesP = new Paragraph(notes);

                // f = notesP.getFont();
                //   f.setSize(f.getSize()-2);
                notesP.setIndentationLeft(30.0f);
                notesP.setSpacingAfter(15.0f);
                document.add(p);
                document.add(notesP);

                entryCount++;
            }
        }

    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    } finally {
        GUI.clearWaitCursor();
    }
    // step 5: we close the document
    document.close();

}

From source file:tufts.vue.PresentationNotes.java

License:Educational Community License

private static void outlineChildNode(Document d, float indentation, LWNode n, int entryCount) {
    String notes = n.getNotes();//  w  w  w .j a v a2s.  co m
    String nodeLabel = n.getLabel();

    if (nodeLabel == null || nodeLabel.length() == 0)
        nodeLabel = "Node";

    Paragraph p = new Paragraph(entryCount + ".  " + n.getLabel().replaceAll("\\n", ""));
    Font f = p.getFont();
    f.setStyle(Font.BOLD);
    f.setSize(14f);
    p.setFont(f);
    p.setIndentationLeft(indentation);
    Paragraph notesP = new Paragraph(notes);

    notesP.setIndentationLeft(indentation + 20);
    notesP.setSpacingAfter(15.0f);
    try {
        d.add(p);
        d.add(notesP);
    } catch (DocumentException e) {
        e.printStackTrace();
    }

}