Example usage for com.itextpdf.text Section add

List of usage examples for com.itextpdf.text Section add

Introduction

In this page you can find the example usage for com.itextpdf.text Section add.

Prototype

@Override
public boolean add(final Element element) 

Source Link

Document

Adds a Paragraph, List, Table or another Section to this Section.

Usage

From source file:report.pdfs.Lighting_PDF_Report.java

private void createTable(Section catPart) throws BadElementException {
    PdfPTable table = new PdfPTable(4);
    table.setSpacingBefore(25);/*from  w w  w. ja  v a2s  .c  o m*/
    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Type"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Expense"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Month"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Year"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);

    selectAll();
    calcLiExpense(table);

    catPart.add(table);
}

From source file:report.pdfs.Lighting_PDF_Report.java

private void addBarChart(Section catPart) {
    Lighting_Bar_Chart_Report chart = new Lighting_Bar_Chart_Report(show, "Lighting Expenses Overview");
    Image To_be_Added = null;/*from w  w w.  j ava  2s  . c  o  m*/
    try {
        To_be_Added = Image.getInstance("bar_chart.png");
    } catch (BadElementException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    To_be_Added.setAlignment(Image.MIDDLE | Image.TEXTWRAP);
    //To_be_Added.setBorder(Image.BOX);
    //To_be_Added.setBorderWidth(15);

    catPart.add(To_be_Added);
}

From source file:report.pdfs.Lighting_PDF_Report.java

private void addPieChart(Section catPart) {
    Lighting_Pie_Chart_Report chart = new Lighting_Pie_Chart_Report(show, "Comparison",
            "Lighting Expenses Overview");
    Image To_be_Added = null;//from ww w. j a  v  a2 s.c o  m
    try {
        To_be_Added = Image.getInstance("pie_chart.png");
    } catch (BadElementException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    To_be_Added.setAlignment(Image.MIDDLE | Image.TEXTWRAP);
    //To_be_Added.setBorder(Image.BOX);
    //To_be_Added.setBorderWidth(15);

    catPart.add(To_be_Added);
}

From source file:report.pdfs.Machinery_PDF_Report.java

private void createTable(Section catPart) throws BadElementException {
    PdfPTable table = new PdfPTable(4);
    table.setSpacingBefore(25);/*from   www .  j a  v a2 s  .  c  om*/
    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Type"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Expense"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Month"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Year"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);

    selectAll();
    calcMaExpense(table);

    catPart.add(table);
}

From source file:report.pdfs.Machinery_PDF_Report.java

private void addBarChart(Section catPart) {
    Machinery_Bar_Chart_Report chart = new Machinery_Bar_Chart_Report(show, "Machinery Expenses Overview");
    Image To_be_Added = null;//w  w  w  . ja v  a 2 s .co  m
    try {
        To_be_Added = Image.getInstance("bar_chart.png");
    } catch (BadElementException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    To_be_Added.setAlignment(Image.MIDDLE | Image.TEXTWRAP);
    //To_be_Added.setBorder(Image.BOX);
    //To_be_Added.setBorderWidth(15);

    catPart.add(To_be_Added);
}

From source file:report.pdfs.Machinery_PDF_Report.java

private void addPieChart(Section catPart) {
    Machinery_Pie_Chart_Report chart = new Machinery_Pie_Chart_Report(show, "Comparison",
            "Machinery Expenses Overview");
    Image To_be_Added = null;// ww  w  . j a  v a2 s . c om
    try {
        To_be_Added = Image.getInstance("pie_chart.png");
    } catch (BadElementException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    To_be_Added.setAlignment(Image.MIDDLE | Image.TEXTWRAP);
    //To_be_Added.setBorder(Image.BOX);
    //To_be_Added.setBorderWidth(15);

    catPart.add(To_be_Added);
}

From source file:report.pdfs.Medical_PDF_Report.java

private void createTable(Section catPart) throws BadElementException {
    PdfPTable table = new PdfPTable(5);
    table.setSpacingBefore(25);//from w w w.jav a 2s.c  o  m
    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Type"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Cow Tag"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Info"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Date"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Medical Cost"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);

    selectAll();
    getExpenses(table);

    catPart.add(table);
}

From source file:report.pdfs.Medical_PDF_Report.java

private void addBarChart(Section catPart) {
    Medical_Bar_Chart_Report chart = new Medical_Bar_Chart_Report(show, "Medical Expenses Overview");
    Image To_be_Added = null;//from w w w.ja  v a 2  s . co  m
    try {
        To_be_Added = Image.getInstance("bar_chart.png");
    } catch (BadElementException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    To_be_Added.setAlignment(Image.MIDDLE | Image.TEXTWRAP);
    //To_be_Added.setBorder(Image.BOX);
    //To_be_Added.setBorderWidth(15);

    catPart.add(To_be_Added);
}

From source file:report.pdfs.Medical_PDF_Report.java

private void addPieChart(Section catPart) {
    Medical_Pie_Chart_Report chart = new Medical_Pie_Chart_Report(show, "Comparison",
            "Medical Expenses Overview");
    Image To_be_Added = null;/*w ww. ja va2 s  .c  o  m*/
    try {
        To_be_Added = Image.getInstance("pie_chart.png");
    } catch (BadElementException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    To_be_Added.setAlignment(Image.MIDDLE | Image.TEXTWRAP);
    //To_be_Added.setBorder(Image.BOX);
    //To_be_Added.setBorderWidth(15);

    catPart.add(To_be_Added);
}

From source file:report.pdfs.Mortgaged_PDF_Report.java

private void createTable(Section catPart) throws BadElementException {
    PdfPTable table = new PdfPTable(4);
    table.setSpacingBefore(25);//w ww  .ja v  a2 s  . co m
    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Type"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Expense"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Month"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Year"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);

    selectAll();
    calcMExpense(table);

    catPart.add(table);
}