List of usage examples for com.itextpdf.text Section add
@Override public boolean add(final Element element)
Paragraph
, List
, Table
or another Section
to this Section
. From source file:pdfgen.pdf_generation_try5.java
public void createTable(Section subCatPart) throws BadElementException { PdfPTable table = new PdfPTable(3); // t.setBorderColor(BaseColor.GRAY); // t.setPadding(4); // t.setSpacing(4); // t.setBorderWidth(1); PdfPCell c1 = new PdfPCell(new Phrase("Table Header 1")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1);//from w w w . java 2s. c o m c1 = new PdfPCell(new Phrase("Table Header 2")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Table Header 3")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); table.addCell("1.0"); table.addCell("1.1"); table.addCell("1.2"); table.addCell("2.1"); table.addCell("2.2"); table.addCell("2.3"); subCatPart.add(table); }
From source file:pdfgen.pdf_generation_try5.java
public void createList(Section subCatPart) { List list = new List(true, false, 10); list.add(new ListItem("First point")); list.add(new ListItem("Second point")); list.add(new ListItem("Third point")); subCatPart.add(list); }
From source file:report.pdfs.Basics_PDF_Report.java
private void createTable(Section catPart) throws BadElementException { PdfPTable table = new PdfPTable(4); table.setSpacingBefore(25);/*from w w w .j av a2 s . 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(); calcFExpense(table); calcGExpense(table); calcLExpense(table); calcLiExpense(table); calcMaExpense(table); calcMExpense(table); calcRExpense(table); calcSExpense(table); calcWExpense(table); catPart.add(table); }
From source file:report.pdfs.Basics_PDF_Report.java
private void addBarChart(Section catPart) { Basics_Bar_Chart_Report chart = new Basics_Bar_Chart_Report(show, "Basic Expenses Overview"); Image To_be_Added = null;/*from w ww. j a v a2 s . 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.Basics_PDF_Report.java
private void addPieChart(Section catPart) { Basics_Pie_Chart_Report chart = new Basics_Pie_Chart_Report(show, "Comparison", "Basic Expenses Overview"); Image To_be_Added = null;/*from ww w. ja 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.Feed_PDF_Report.java
private void createTable(Section catPart) throws BadElementException { PdfPTable table = new PdfPTable(8); table.setSpacingBefore(25);//from ww w .ja v 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("Herd ID")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Hay Cost")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Nuts Cost")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Silage Cost")); 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); c1 = new PdfPCell(new Phrase("Total")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); selectAll(); getExpenses(table); catPart.add(table); }
From source file:report.pdfs.Feed_PDF_Report.java
private void addBarChart(Section catPart) { Feed_Bar_Chart_Report chart = new Feed_Bar_Chart_Report(show, "Feed Expenses Overview"); Image To_be_Added = null;// w w w . j a v a 2 s. c om 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.Feed_PDF_Report.java
private void addPieChart(Section catPart) { Feed_Pie_Chart_Report chart = new Feed_Pie_Chart_Report(show, "Comparison", "Feed Expenses Overview"); Image To_be_Added = null;//from w w w . j a v a 2 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.Fertilizer_PDF_Report.java
private void createTable(Section catPart) throws BadElementException { PdfPTable table = new PdfPTable(4); table.setSpacingBefore(25);//w w w .j ava 2 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(); calcFExpense(table); catPart.add(table); }
From source file:report.pdfs.Fertilizer_PDF_Report.java
private void addBarChart(Section catPart) { Fertilizer_Bar_Chart_Report chart = new Fertilizer_Bar_Chart_Report(show, "Fertilizer Expenses Overview"); Image To_be_Added = null;/*from w w w .j a v a 2 s . 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); }