List of usage examples for com.itextpdf.text Chapter addSection
public Section addSection(final Paragraph title)
Section
, adds it to this Section
and returns it. From source file:generadorPDF.generarPDF.java
private static void addContent(Document document, Socio sociox, Resolucion res) 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")); subCatPart.add(new Paragraph(sociox.getApellido() + sociox.getNombre() + sociox.getLegajo_socio())); 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 createList(subCatPart);/* w ww. ja v a2 s . co m*/ Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); 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); }
From source file:has.GenerateReceipt.java
private static void addContent(Document document) throws DocumentException, IOException, SQLException, ClassNotFoundException { Anchor anchor = new Anchor("BILL DETAILS(Generated by HAS) on " + new Date(), catFont); // anchor.setName("First Chapter"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); addEmptyLine(preface, 2);/*from www.j av a 2 s .c o m*/ Statement stmt = null, stmt1 = null, stmt2 = null, stmt3 = null, stmt4 = null, stmt5 = null; Connection conn = null; String w = null; int found = 0; // System.out.println("At the start"); try { conn = DriverManager.getConnection(url, user, password); stmt = conn.createStatement(); stmt1 = conn.createStatement(); stmt2 = conn.createStatement(); stmt3 = conn.createStatement(); stmt4 = conn.createStatement(); stmt5 = conn.createStatement(); // stmt1 = conn.createStatement(); } catch (Exception rx) { System.out.println("in catch"); } int present = 0; double minfre = 0; String sql2 = "SELECT id,Value FROM central"; Vector tariff = null, discount = null, rates = null, totalbookings = null; ResultSet rsz = stmt.executeQuery(sql2); int iad; while (rsz.next()) { iad = rsz.getInt("id"); if (iad == 9) { minfre = rsz.getDouble("Value"); } if (iad == 10) { ObjectInputStream o = null; byte[] arr = rsz.getBytes("Value"); tariff = new Vector(); if (arr != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr)); tariff = (Vector) o.readObject(); } } if (iad == 11) { ObjectInputStream o = null; byte[] arr = rsz.getBytes("Value"); rates = new Vector(); if (arr != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr)); rates = (Vector) o.readObject(); } } if (iad == 12) { ObjectInputStream o = null; byte[] arr = rsz.getBytes("Value"); totalbookings = new Vector(); if (arr != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr)); totalbookings = (Vector) o.readObject(); } } if (iad == 13) { ObjectInputStream o = null; byte[] arr = rsz.getBytes("Value"); discount = new Vector(); if (arr != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr)); discount = (Vector) o.readObject(); } } if (iad == 14) { present = rsz.getInt("Value"); } } String sql = "SELECT * FROM Customer "; ResultSet rs = null, rs1 = null; try { rs = stmt.executeQuery(sql); } catch (SQLException ex) { Logger.getLogger(CheckOut.class.getName()).log(Level.SEVERE, null, ex); } while (rs.next()) { int x = rs.getInt("ISAC"); if (x == 2) { int y = rs.getInt("SCOD"); if (present == y) { double Totalbill = 0, amount = 0; ObjectInputStream o = null; byte[] arr = rs.getBytes("Catering"); Vector Catering = new Vector(); if (arr != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr)); Catering = (Vector) o.readObject(); } Paragraph subPara2 = new Paragraph(rs.getString("Name") + " " + rs.getString("I"), subFont); Section subCatPart = catPart.addSection(subPara2); // Section subCatPart2 = catPart.addSection(subPara2); if (Catering.size() != 0) { createTable(subCatPart, Catering); System.out.println("Enterte in catering"); CateringObject obj = (CateringObject) Catering.elementAt(0); Totalbill = obj.bill; // tb.addRow(new Object[]{new String(rs.getString("Name")),new String(rs.getString("I")),new String(obj.date),new String(obj.item),new Double(obj.bill) }); for (int f = 1; f < Catering.size(); f++) { obj = (CateringObject) Catering.elementAt(f); // tb.addRow(new Object[]{new String(""),new String(""),new String(obj.date),new String(obj.item),new Double(obj.bill) }); Totalbill = Totalbill + obj.bill; } String updatestr = "UPDATE customer SET Catering = ? WHERE id = " + rs.getInt("id"); PreparedStatement p = conn.prepareStatement(updatestr); p.setObject(1, null); p.executeUpdate(); } int ap1 = rs.getInt("SCOD") - rs.getInt("SCID") + 1; int ap = rs.getInt("History") + ap1; System.out.println("ap1=" + ap1); System.out.println("ap=" + ap); sql = "UPDATE customer SET history= " + ap + " WHERE id= " + rs.getInt("id"); System.out.println(sql); stmt1.executeUpdate(sql); sql = "UPDATE customer SET ISAC= 0 WHERE id= " + rs.getInt("id"); System.out.println(sql); stmt5.executeUpdate(sql); int to = 0; String room = rs.getString("Room"); String roompart = room.substring(0, 2); double roomrent = 0, tariffa = 0, discounta = 0, advance = 0; advance = rs.getDouble("RTP"); System.out.println(roompart); if (roompart.equalsIgnoreCase("SA")) { amount = ap1 * (int) rates.elementAt(0); roomrent = amount; System.out.println("roomrent=" + roomrent); amount = amount + Totalbill; tariffa = (amount * (double) tariff.elementAt(0)) / 100; amount = amount + tariffa; to = (int) totalbookings.elementAt(0); to = to + ap1; totalbookings.setElementAt(to, 0); } if (roompart.equalsIgnoreCase("SNA")) { amount = ap1 * (int) rates.elementAt(1); roomrent = amount; amount = amount + Totalbill; tariffa = (amount * (double) tariff.elementAt(1)) / 100; amount = amount + (amount * (double) tariff.elementAt(1)) / 100; to = (int) totalbookings.elementAt(1); to = to + ap1; totalbookings.setElementAt(to, 1); } if (roompart.equalsIgnoreCase("DA")) { amount = ap1 * (int) rates.elementAt(2); roomrent = amount; amount = amount + Totalbill; tariffa = (amount * (double) tariff.elementAt(2)) / 100; amount = amount + (amount * (double) tariff.elementAt(2)) / 100; to = (int) totalbookings.elementAt(2); to = to + ap1; totalbookings.setElementAt(to, 2); } if (roompart.equalsIgnoreCase("DNA")) { amount = ap1 * (int) rates.elementAt(3); roomrent = amount; amount = amount + Totalbill; tariffa = (amount * (double) tariff.elementAt(3)) / 100; amount = amount + (amount * (double) tariff.elementAt(3)) / 100; to = (int) totalbookings.elementAt(3); to = to + ap1; totalbookings.setElementAt(to, 3); } String updatestr = "UPDATE central SET Value = ? WHERE id =12 "; PreparedStatement p = conn.prepareStatement(updatestr); p.setObject(1, totalbookings); p.executeUpdate(); int history = rs.getInt("history"); double cusfre = history / present; double minfree = (double) discount.elementAt(0); double minbill = (double) discount.elementAt(1); double d1 = (double) discount.elementAt(2); double d2 = (double) discount.elementAt(3); double d3 = (double) discount.elementAt(4); double d4 = (double) discount.elementAt(5); if (cusfre < minfree && amount < minbill) { discounta = (amount * d1) / 100; amount = amount - discounta; } if (cusfre < minfree && amount > minbill) { discounta = (amount * d2) / 100; amount = amount - discounta; } if (cusfre > minfree && amount < minbill) { discounta = (amount * d3) / 100; amount = amount - discounta; } if (cusfre > minfree && amount > minbill) { discounta = (amount * d4) / 100; amount = amount - discounta; } amount = amount - advance; // tb2.addRow(new Object[]{new String(rs.getString("Name")),new String(rs.getString("I")),new Double(Totalbill),new Double(advance),new Double(roomrent),new Double(tariffa),new Double(discounta),new Double(amount)}); } } if (x == 1) { Vector advancev = null, ecid = null, ecod = null, advanceroom = null; ObjectInputStream o = null; byte[] arr = rs.getBytes("Advance"); advancev = new Vector(); if (arr != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr)); advancev = (Vector) o.readObject(); } byte[] arr2 = rs.getBytes("Advance_room"); advanceroom = new Vector(); if (arr2 != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr2)); advanceroom = (Vector) o.readObject(); } byte[] arr3 = rs.getBytes("ECID"); ecid = new Vector(); if (arr3 != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr3)); ecid = (Vector) o.readObject(); } byte[] arr4 = rs.getBytes("ECOD"); ecod = new Vector(); if (arr4 != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr4)); ecod = (Vector) o.readObject(); } for (int l = 0; l < ecod.size(); l++) { long y = (long) ecod.elementAt(l); if (present == y) { double Totalbill = 0, amount = 0; // ObjectInputStream o = null; byte[] arr1 = rs.getBytes("Catering"); Vector Catering = new Vector(); if (arr1 != null) { o = new ObjectInputStream(new ByteArrayInputStream(arr1)); Catering = (Vector) o.readObject(); } Paragraph subPara2 = new Paragraph(rs.getString("Name") + " " + rs.getString("I"), subFont); Section subCatPart = catPart.addSection(subPara2); if (Catering.size() != 0) { createTable(subCatPart, Catering); CateringObject obj = (CateringObject) Catering.elementAt(0); Totalbill = obj.bill; //tb.addRow(new Object[]{new String(rs.getString("Name")),new String(rs.getString("I")),new String(obj.date),new String(obj.item),new Double(obj.bill) }); for (int f = 1; f < Catering.size(); f++) { obj = (CateringObject) Catering.elementAt(f); // tb.addRow(new Object[]{new String(""),new String(""),new String(obj.date),new String(obj.item),new Double(obj.bill) }); Totalbill = Totalbill + obj.bill; } String updatestr = "UPDATE customer SET Catering = ? WHERE id = " + rs.getInt("id"); PreparedStatement p = conn.prepareStatement(updatestr); p.setObject(1, null); p.executeUpdate(); } System.out.println("l == " + l); System.out.println("size = " + ecod.size()); System.out.println(ecod); System.out.println(ecid); long ppp = (long) ecod.get(l); long qqq = (long) ecid.get(l); System.out.println("ecod = " + ppp); System.out.println("ecid = " + qqq); long ap1 = ppp - qqq + 1; // sql="UPDATE customer SET ISAC=0 WHERE id= "+rs.getInt("id"); // stmt3.executeUpdate(sql); int ap = rs.getInt("History") + (int) ap1; sql = "UPDATE customer SET history=" + ap + " WHERE id= " + rs.getInt("id"); stmt4.executeUpdate(sql); int to = 0; String room = (String) advanceroom.elementAt(l); String roompart = room.substring(0, 1); double roomrent = 0, tariffa = 0, discounta = 0, advance = 0; advance = Double.parseDouble((String) advancev.elementAt(l)); if (roompart.equalsIgnoreCase("SA")) { amount = ap1 * (int) rates.elementAt(0); roomrent = amount; amount = amount + Totalbill; tariffa = (amount * (double) tariff.elementAt(0)) / 100; amount = amount + tariffa; to = (int) totalbookings.elementAt(0); to = to + (int) ap1; totalbookings.setElementAt(to, 0); } if (roompart.equalsIgnoreCase("SNA")) amount = (double) rates.elementAt(1); { amount = ap1 * (int) rates.elementAt(1); roomrent = amount; amount = amount + Totalbill; tariffa = (amount * (double) tariff.elementAt(1)) / 100; amount = amount + (amount * (double) tariff.elementAt(1)) / 100; to = (int) totalbookings.elementAt(1); to = to + (int) ap1; totalbookings.setElementAt(to, 1); } if (roompart.equalsIgnoreCase("DA")) { amount = ap1 * (int) rates.elementAt(2); roomrent = amount; amount = amount + Totalbill; tariffa = (amount * (double) tariff.elementAt(2)) / 100; amount = amount + (amount * (double) tariff.elementAt(2)) / 100; to = (int) totalbookings.elementAt(2); to = to + (int) ap1; totalbookings.setElementAt(to, 2); } if (roompart.equalsIgnoreCase("DNA")) { amount = ap1 * (int) rates.elementAt(3); roomrent = amount; amount = amount + Totalbill; tariffa = (amount * (double) tariff.elementAt(3)) / 100; amount = amount + (amount * (double) tariff.elementAt(3)) / 100; to = (int) totalbookings.elementAt(3); to = to + (int) ap1; totalbookings.setElementAt(to, 3); } String updatestr = "UPDATE central SET Value = ? WHERE id =12 "; PreparedStatement p = conn.prepareStatement(updatestr); p.setObject(1, totalbookings); p.executeUpdate(); int history = rs.getInt("history"); double cusfre = history / present; double minfree = (double) discount.elementAt(0); double minbill = (double) discount.elementAt(1); double d1 = (double) discount.elementAt(2); double d2 = (double) discount.elementAt(3); double d3 = (double) discount.elementAt(4); double d4 = (double) discount.elementAt(5); if (cusfre < minfree && amount < minbill) { discounta = (amount * d1) / 100; amount = amount - discounta; } if (cusfre < minfree && amount > minbill) { discounta = (amount * d2) / 100; amount = amount - discounta; } if (cusfre > minfree && amount < minbill) { discounta = (amount * d3) / 100; amount = amount - discounta; } if (cusfre > minfree && amount > minbill) { discounta = (amount * d4) / 100; amount = amount - discounta; } amount = amount - advance; // tb2.addRow(new Object[]{new String(rs.getString("Name")),new String(rs.getString("I")),new Double(Totalbill),new Double(advance),new Double(roomrent),new Double(tariffa),new Double(discounta),new Double(amount)}); } } } // add a table //createTable(subCatPart); } Paragraph subPara2 = new Paragraph("Thanks for choosing us .. please visit again", subFont); Section subCatPart2 = catPart.addSection(subPara2); /* Anchor anchor2 = new Anchor("Thanks for choosing us .. please visit again", catFont); Chapter catPart2 = new Chapter(new Paragraph(anchor), 1);*/ // now add all this to the document document.add(catPart); //document.add(catPart2); }
From source file:klasy.PdfFiles.java
public 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 createList(subCatPart);//from w w w . ja v a 2s.c o m Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); 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); }
From source file:nl.ctmm.trait.proteomics.qcviewer.utils.ReportPDFExporter.java
License:Apache License
/** * Export a report to a pdf file./*w w w . j a va2 s. c o m*/ * * @param allMetricsMap map of all QC metrics - keys and description. * @param selectedReports the report units to be exported in PDF format. * @param preferredPDFDirectory the directory the pdf document should be exported to. * @return Path of the created PDF document if it is successfully created - otherwise return empty string. */ public static String exportReportUnitInPDFFormat(final Map<String, String> allMetricsMap, final ArrayList<ReportUnit> selectedReports, final String preferredPDFDirectory) { //Obtain current timestamp. final java.util.Date date = new java.util.Date(); final String timestampString = CREATION_DATE_TIME_FORMAT.format(date); //Replace all occurrences of special character ':' from time stamp since ':' is not allowed in filename. final String filenameTimestamp = timestampString.replace(':', '-'); //Instantiation of document object - landscape format using the rotate() method final Document document = new Document(PageSize.A4.rotate(), PDF_PAGE_MARGIN, PDF_PAGE_MARGIN, PDF_PAGE_MARGIN, PDF_PAGE_MARGIN); final String pdfFileName = preferredPDFDirectory + "\\QCReports-" + filenameTimestamp + FILE_TYPE_EXTENSION; try { //Creation of PdfWriter object // PdfWriter writer; // writer = PdfWriter.getInstance(document, new FileOutputStream(pdfFileName)); document.open(); for (ReportUnit reportUnit : selectedReports) { //New page for each report. document.newPage(); //Creation of chapter object final Paragraph pageTitle = new Paragraph( String.format(PDF_PAGE_TITLE, reportUnit.getMsrunName(), timestampString), Constants.PDF_TITLE_FONT); pageTitle.setAlignment(Element.ALIGN_CENTER); final Chapter chapter1 = new Chapter(pageTitle, 1); chapter1.setNumberDepth(0); //Creation of TIC graph section object final String graphTitle = String.format(TIC_GRAPH_SECTION_TITLE, reportUnit.getMsrunName()); final Paragraph ticGraphSection = new Paragraph(graphTitle, Constants.PDF_SECTION_FONT); ticGraphSection.setSpacingBefore(PDF_PARAGRAPH_SPACING); ticGraphSection.add(Chunk.NEWLINE); //Insert TIC Graph in ticGraphSection. ticGraphSection.add(createTICChartImage(reportUnit)); chapter1.addSection(ticGraphSection); final String metricsTitle = String.format(METRICS_VALUES_SECTION_TITLE, reportUnit.getMsrunName()); final Paragraph metricsValuesSection = new Paragraph(metricsTitle, Constants.PDF_SECTION_FONT); metricsValuesSection.setSpacingBefore(PDF_PARAGRAPH_SPACING); //Reference: http://www.java-connect.com/itext/add-table-in-PDF-document-using-java-iText-library.html //TODO: Insert metrics values table in metricsValuesSection metricsValuesSection.add(createMetricsValuesTable(allMetricsMap, reportUnit)); chapter1.addSection(metricsValuesSection); //Addition of a chapter to the main document document.add(chapter1); } document.close(); return pdfFileName; } catch (final DocumentException e) { // TODO Explain when these exception can occur. /* FileNotFoundException will be thrown by the FileInputStream, FileOutputStream, and * RandomAccessFile constructors when a file with the specified path name does not exist. * It will also be thrown by these constructors if the file does exist but for some reason * is inaccessible, for example when an attempt is made to open a read-only file for writing. * DocumentException Signals that an error has occurred in a Document. */ logger.log(Level.SEVERE, PDF_EXPORT_EXCEPTION_MESSAGE, e); return ""; } }
From source file:org.fossa.rolp.util.PdfStreamSource.java
License:Open Source License
private void addContent(PdfWriter writer) throws DocumentException, PdfFormatierungsException { Anchor anchor = new Anchor("Lernentwicklungsbericht", lernentwicklungsberichtUeberschriftFont); Chapter chapterLEB = new Chapter(new Paragraph(anchor), 1); chapterLEB.setNumberDepth(0);/*from w w w .j a v a 2 s . c o m*/ Paragraph paragraphHeader = new Paragraph(); paragraphHeader.setLeading(FIXED_LEADING_TEXT, 1); sectionCount += 1; Section headerSection = chapterLEB.addSection(paragraphHeader); headerSection.setNumberDepth(0); paragraphHeader.add(Chunk.NEWLINE); paragraphHeader.add(PdfFormatHelper.buildHeaderNameLine(lebData.getSchuelername(), headerFont)); paragraphHeader.add(Chunk.NEWLINE); paragraphHeader.add(PdfFormatHelper.buildHeaderKlassendatenLine(lebData, headerFont)); headerSection.add(Chunk.NEWLINE); headerSection.add(Chunk.NEWLINE); document.add(chapterLEB); insertDummyLineIfNecessary(writer); addKlassenbrief(chapterLEB, writer); addIndividuelleEinschaetzung(chapterLEB, writer); addFacheinschaetzungen(chapterLEB, writer); }
From source file:org.fossa.rolp.util.PdfStreamSource.java
License:Open Source License
private void addFacheinschaetzungen(Chapter chapterLEB, PdfWriter writer) throws DocumentException, PdfFormatierungsException { for (LebFacheinschaetzungData facheinschaetzungsdaten : lebData.getFacheinschaetzungsdaten()) { sectionCount += 1;/*ww w. jav a 2 s. c o m*/ breakHurenkind(writer); breakSchusterjunge(writer); Paragraph paragraphFacheinschaetzung = new Paragraph(); Section facheinschaetzungsTextSection = chapterLEB.addSection(paragraphFacheinschaetzung); facheinschaetzungsTextSection.setNumberDepth(0); Collection<String> fachbezeichnungen = facheinschaetzungsdaten.getFachbezeichnungen(); fachbezeichnungen.add(facheinschaetzungsdaten.getFachname()); String facheinschaetzung = facheinschaetzungsdaten.getFacheinschaetzung(); Integer firstIndex = null; String boldedWord = ""; for (String fachbezeichnung : fachbezeichnungen) { int index = facheinschaetzung.toLowerCase().indexOf(fachbezeichnung.toLowerCase()); if (index != -1 && (firstIndex == null || firstIndex > index)) { firstIndex = index; boldedWord = fachbezeichnung; } } Paragraph facheinschaetzungParapgraph = new Paragraph(); facheinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED); facheinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor); if (firstIndex == null) { facheinschaetzungParapgraph.add(new Phrase( facheinschaetzungsdaten.getFacheinschaetzung().replace('\t', '\0'), standardTextFont)); } else { String beforeBoldWord = facheinschaetzung.substring(0, firstIndex); facheinschaetzungParapgraph.add(new Phrase(beforeBoldWord.replace('\t', '\0'), standardTextFont)); String boldWord = facheinschaetzung.substring(firstIndex, firstIndex + boldedWord.length()); facheinschaetzungParapgraph.add(new Phrase(boldWord, standardTextBoldFont)); String afterBoldWord = facheinschaetzung.substring(firstIndex + boldedWord.length()); facheinschaetzungParapgraph.add(new Phrase(afterBoldWord.replace('\t', '\0'), standardTextFont)); } facheinschaetzungParapgraph.setFont(standardTextFont); facheinschaetzungsTextSection.add(facheinschaetzungParapgraph); Paragraph unterschriftParagraph = new Paragraph(); document.add(facheinschaetzungsTextSection); Section facheinschaetzungsUnterschriftSection = chapterLEB.addSection(unterschriftParagraph); facheinschaetzungsUnterschriftSection.setNumberDepth(0); unterschriftParagraph.add( new Phrase(facheinschaetzungsdaten.getUnterschrift().replace('\t', '\0'), standardTextFont)); unterschriftParagraph.setAlignment(Element.ALIGN_RIGHT); unterschriftParagraph.add(Chunk.NEWLINE); unterschriftParagraph.add(Chunk.NEWLINE); document.add(facheinschaetzungsUnterschriftSection); alertHurenkind(writer); insertDummyLineIfNecessary(writer); } }
From source file:org.fossa.rolp.util.PdfStreamSource.java
License:Open Source License
private void addIndividuelleEinschaetzung(Chapter chapterLEB, PdfWriter writer) throws DocumentException, PdfFormatierungsException { if (!lebData.getIndividuelleEinschaetzung().isEmpty()) { sectionCount += 1;//w ww.ja v a2s. co m breakHurenkind(writer); breakSchusterjunge(writer); Paragraph paragraphIndividuelleEinschaetzung = new Paragraph(); Section individuelleEinschaetzungsTextSection = chapterLEB .addSection(paragraphIndividuelleEinschaetzung); individuelleEinschaetzungsTextSection.setNumberDepth(0); Paragraph schuelereinschaetzungParapgraph = new Paragraph( lebData.getIndividuelleEinschaetzung().replace('\t', '\0'), standardTextFont); schuelereinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED); schuelereinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor); individuelleEinschaetzungsTextSection.add(schuelereinschaetzungParapgraph); document.add(individuelleEinschaetzungsTextSection); document.add(getKlassenlehrerunterschrift(chapterLEB)); alertHurenkind(writer); insertDummyLineIfNecessary(writer); } }
From source file:org.fossa.rolp.util.PdfStreamSource.java
License:Open Source License
private void addKlassenbrief(Chapter chapterLEB, PdfWriter writer) throws DocumentException, PdfFormatierungsException { if (!lebData.getKlassenbrief().isEmpty()) { sectionCount += 1;//from www . j av a 2 s . com breakSchusterjunge(writer); Paragraph paragraphKlassenbrief = new Paragraph(); Section klassenbriefSection = chapterLEB.addSection(paragraphKlassenbrief); klassenbriefSection.setNumberDepth(0); Paragraph klasseneinschaetzungParapgraph = new Paragraph(lebData.getKlassenbrief().replace('\t', '\0'), standardTextFont); klasseneinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED); klasseneinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor); klasseneinschaetzungParapgraph.add(Chunk.NEWLINE); if (lebData.getIndividuelleEinschaetzung().isEmpty()) { klassenbriefSection.add(klasseneinschaetzungParapgraph); document.add(klassenbriefSection); document.add(getKlassenlehrerunterschrift(chapterLEB)); } else { klasseneinschaetzungParapgraph.add(Chunk.NEWLINE); klassenbriefSection.add(klasseneinschaetzungParapgraph); document.add(klassenbriefSection); } alertLonelyHeader(writer); insertDummyLineIfNecessary(writer); } }
From source file:org.sharegov.cirm.utils.PDFExportUtil.java
License:Apache License
private static void addContent(Document doc, Json data) throws DocumentException { Anchor anchor = new Anchor(); //new Anchor("First Chapter", catFont); //anchor.setName("First Chapter Anchor"); Chapter catPart = new Chapter(new Paragraph(anchor), 1); catPart.setNumberDepth(0);// w w w . j a v a 2 s . c o m Paragraph subPara = new Paragraph(); //new Paragraph("SubCategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.setNumberDepth(0); createTable(subCatPart, data); //Add everything to the document doc.add(catPart); }
From source file:org.sharegov.cirm.utils.PDFViewReport.java
License:Apache License
private void addContent(Document d, Json data) { Anchor anchor = new Anchor(); Chapter catPart = new Chapter(new Paragraph(anchor), 1); catPart.setNumberDepth(0);// ww w.j a v a2 s .co m Paragraph subPara = new Paragraph(); //new Paragraph("SubCategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.setNumberDepth(0); try { addTopTable(subCatPart, data); addDescription(subCatPart, data); addQuestions(subCatPart, data); addActors(subCatPart, data); addActivities(subCatPart, data); d.add(catPart); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Problem during addContend for BO: " + data.toString(), e); } }