List of usage examples for com.itextpdf.text Chapter Chapter
public Chapter(String title, int number)
Chapter
. From source file:project1.SimplePdf.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: int id;/*from www.j a va2s . c om*/ String name; id = Integer.parseInt(txtid.getText()); name = txtname.getText(); try { OutputStream file = new FileOutputStream(new File("F:\\PDFFILES\\" + id + ".pdf")); Document document = new Document(); PdfWriter.getInstance(document, file); document.open(); // Image im=Image.getInstance("E:\\PDFFILES\\FUUAST.png"); // document.add(new Paragraph("")); // document.add(im); Paragraph title1 = new Paragraph(name + id, FontFactory.getFont(FontFactory.HELVETICA, 36, Font.BOLDITALIC, new CMYKColor(0, 255, 255, 17))); Chapter chapter1 = new Chapter(title1, 1); chapter1.setNumberDepth(0); document.add(chapter1); document.add(new Paragraph("\n\n\n\n")); document.add(new Paragraph("Name: " + name)); document.add(new Paragraph("Id: " + id)); try { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.OPEN)) { desktop.open(new File("D:\\PDFFILES\\" + id + ".pdf")); } else { System.out.println("Open is not supported"); } } catch (IOException exp) { exp.printStackTrace(); } document.close(); file.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:report.pdfs.Basics_PDF_Report.java
private void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("Table Report", catFont); anchor.setName("Table Report"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph paragraph = new Paragraph(); // Add a table document.add(new Paragraph()); createTable(catPart);/*w w w .ja v a 2 s . c o m*/ // Now add all this to the document document.add(catPart); // Start a new page document.newPage(); // Next section anchor = new Anchor("Second Chapter", catFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 2); // Add an image addEmptyLine(paragraph, 5); addBarChart(catPart); // Now add all this to the document document.add(catPart); // Start a new page document.newPage(); // Next section anchor = new Anchor("Third Chapter", catFont); anchor.setName("Third Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 3); // Add an image addEmptyLine(paragraph, 5); addPieChart(catPart); // Now add all this to the document document.add(catPart); }
From source file:sipl.recursos.GenerarPDFGrafica.java
private void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor(Titulo, catFont); anchor.setName(Titulo);// ww w . j ava 2 s . com Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("", subFont); Section subCatPart = catPart.addSection(subPara); createTable(subCatPart); String p = Titulo.charAt(0) + ""; if (p.equals("M")) { subPara = new Paragraph("", subFont); subCatPart = catPart.addSection(subPara); createTable2(subCatPart); } document.add(catPart); }
From source file:sipl.recursos.GenerarPDFListar.java
private void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor(Titulo, catFont); anchor.setName(Titulo);/* www . j a v a 2 s .c o m*/ Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("", subFont); Section subCatPart = catPart.addSection(subPara); createTable(subCatPart); document.add(catPart); }
From source file:sipl.recursos.GenerarPDFtipomaterial.java
private static void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor(Titulo, catFont); anchor.setName(Titulo);/*from w ww . j a v a2 s . c o m*/ Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("", subFont); Section subCatPart = catPart.addSection(subPara); createTable(subCatPart); document.add(catPart); }
From source file:tn.com.hitechart.eds.Util.pdfRpport.FirstPdf.java
private void addContent(Document document) throws DocumentException { // Second parameter is the number of the chapter Phrase phrase = new Phrase("", catFontblanc); phrase.add(""); Chapter catPart = new Chapter(new Paragraph(phrase), 0); Chapter catParttask = new Chapter(new Paragraph(phrase), 0); Paragraph p = new Paragraph("", catFontblanc); Section subCatPart = catPart.addSection(p); // subCatPart.add(new Paragraph("Hello1111111111111111111111 "+user.getLogin())); //subPara = new Paragraph("Subcategory 22222222222222 "+pointage.getDate_timeInM(), subFont); //subCatPart = catPart.addSection(subPara); //subCatPart.add(new Paragraph("Paragraph 1")); //subCatPart.add(new Paragraph("Paragraph 2")); //subCatPart.add(new Paragraph("Paragraph 3")); // add a list //createList(subCatPart); //Paragraph paragraph = new Paragraph(); //addEmptyLine(paragraph, 5); //subCatPart.add(paragraph); // add a table createTable(subCatPart);/*w w w.j a va 2s .c o m*/ // now add all this to the document document.add(catPart); //document.add(catParttask); // Next section // anchor = new Anchor("Second Chapter", catFont); //anchor.setName("Second Chapter"); // Second parameter is the number of the chapter //catPart = new Chapter(new Paragraph(anchor), 1); //subPara = new Paragraph("Subcategory", subFont); //subCatPart = catPart.addSection(subPara); //subCatPart.add(new Paragraph("This is a very important message")); // now add all this to the document //document.add(catPart); }
From source file:uk.ac.openmf.utils.OpenMFPDFGenerator.java
public static void addContent(Document document, String title, String clientId) throws DocumentException { Anchor anchor = new Anchor(title, catFont); anchor.setName(title);//from w w w. java 2s . c o m // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Loan Account Overview", catFont); addEmptyLine(subPara, 1); Section subCatPart = catPart.addSection(subPara); // add a table createLAOTable(subCatPart, clientId); Paragraph subPara1 = new Paragraph("Savings Account Overview", catFont); addEmptyLine(subPara1, 1); Section subCatPart1 = catPart.addSection(subPara1); // add a table createSAOTable(subCatPart1, clientId); // now add all this to the document document.add(catPart); }
From source file:uk.ac.openmf.utils.OpenMFPDFGenerator.java
public static void addTaskContent(Document document, String title, String omfuId) throws DocumentException { Anchor anchor = new Anchor(title, catFont); anchor.setName(title);/* w ww . ja v a 2 s.c o m*/ // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("User Tasks Overview", catFont); addEmptyLine(subPara, 1); Section subCatPart = catPart.addSection(subPara); // add a table createTasksTable(subCatPart, omfuId); // now add all this to the document document.add(catPart); }
From source file:wtw.ui.GeneratingPdfAction.java
private static void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("First Chapter", catFont); anchor.setName("First Chapter"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Subcategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Hello")); subPara = new Paragraph("Subcategory 2", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Paragraph 1")); subCatPart.add(new Paragraph("Paragraph 2")); subCatPart.add(new Paragraph("Paragraph 3")); // Add a list Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5);/* ww w . j a v a 2 s . c om*/ subCatPart.add(paragraph); // Add a table createTable(subCatPart); // Now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Second Chapter", catFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Subcategory", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("This is a very important message")); // Now add all this to the document document.add(catPart); }