List of usage examples for com.itextpdf.text Phrase Phrase
private Phrase(final boolean dummy)
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private Paragraph getRiskAnalysisDescription(final String analysis) { Paragraph desc = createParagraph("?"); if (analysis.equals(RiskAnalysisTasksNames.THREAT_ANALISIS)) { desc = createParagraph(/*from w ww .ja va 2 s . c o m*/ "This analysis starts with the known events, and propagates their impact over goal trees, documents and social relationships. The new discovered elements are treated as threated elements. The analysis ends when no new elements are found."); desc.add(Chunk.NEWLINE); desc.add(new Phrase("The propagation rules are the following:")); List<Paragraph> pr = new ArrayList<Paragraph>(); pr.add(createP( "If the threatened element is a goal, then the following are also threatened: goal's decomposition's parents, porduced document and delegated goals.")); pr.add(createP( "If the threatened element is a document, then the following are also threatened: document's partOf's parents, goals that need or modify the document and if the document is provided the provided goal.")); desc.add(listParagraphs(pr)); } return getAlaysisDescription(analysis, desc); }
From source file:eu.geopaparazzi.plugins.pdfexport.PdfExportDialogFragment.java
License:Open Source License
public void processNote(Document document, Note note, int count) throws Exception { String name = Utilities.makeXmlSafe(note.getName()); String form = note.getForm(); DaoImages daoImages = new DaoImages(); if (form != null && form.length() > 0) { JSONObject sectionObject = new JSONObject(form); if (!sectionObject.has(FormUtilities.ATTR_SECTIONNAME)) { return; }/* w w w. j a v a 2s . c om*/ String sectionName = sectionObject.getString(FormUtilities.ATTR_SECTIONNAME); Anchor anchor = new Anchor(sectionName); anchor.setName(sectionName); Chapter currentChapter = new Chapter(new Paragraph(anchor), count); addEmptyLine(currentChapter, 3); PdfPTable infoTable = new PdfPTable(2); infoTable.setHeaderRows(0); infoTable.setWidthPercentage(90); currentChapter.add(infoTable); addKeyValueToTableRow(infoTable, "Timestamp", new Date(note.getTimeStamp()).toString()); addKeyValueToTableRow(infoTable, "Latitude", note.getLat() + ""); addKeyValueToTableRow(infoTable, "Longitude", note.getLon() + ""); addEmptyLine(currentChapter, 3); List<String> formsNames = TagsManager.getFormNames4Section(sectionObject); for (String formName : formsNames) { Paragraph section = new Paragraph(formName); currentChapter.addSection(section); addEmptyLine(currentChapter, 3); PdfPTable currentTable = new PdfPTable(2); currentTable.setHeaderRows(1); currentTable.setWidthPercentage(90); currentChapter.add(currentTable); JSONObject form4Name = TagsManager.getForm4Name(formName, sectionObject); JSONArray formItems = TagsManager.getFormItems(form4Name); for (int i = 0; i < formItems.length(); i++) { JSONObject formItem = formItems.getJSONObject(i); if (!formItem.has(FormUtilities.TAG_KEY)) { continue; } String type = formItem.getString(FormUtilities.TAG_TYPE); String key = formItem.getString(FormUtilities.TAG_KEY); String value = formItem.getString(FormUtilities.TAG_VALUE); String label = key; if (formItem.has(FormUtilities.TAG_LABEL)) { label = formItem.getString(FormUtilities.TAG_LABEL); } if (type.equals(FormUtilities.TYPE_PICTURES)) { if (value.trim().length() == 0) { continue; } String[] imageIdsSplit = value.split(Note.IMAGES_SEPARATOR); for (String imageId : imageIdsSplit) { Image image = daoImages.getImage(Long.parseLong(imageId)); String imgName = image.getName(); byte[] imageData = daoImages.getImageData(Long.parseLong(imageId)); com.itextpdf.text.Image itextImage = com.itextpdf.text.Image.getInstance(imageData); Paragraph caption = new Paragraph(imgName); caption.setAlignment(Element.ALIGN_CENTER); PdfPCell keyCell = new PdfPCell(new Phrase(label)); keyCell.setHorizontalAlignment(Element.ALIGN_CENTER); keyCell.setVerticalAlignment(Element.ALIGN_MIDDLE); keyCell.setPadding(10); currentTable.addCell(keyCell); PdfPCell valueCell = new PdfPCell(); valueCell.setHorizontalAlignment(Element.ALIGN_CENTER); valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE); valueCell.setPadding(10); valueCell.addElement(itextImage); valueCell.addElement(caption); currentTable.addCell(valueCell); } } else if (type.equals(FormUtilities.TYPE_MAP)) { if (value.trim().length() == 0) { continue; } String imageId = value.trim(); Image image = daoImages.getImage(Long.parseLong(imageId)); String imgName = image.getName(); byte[] imageData = daoImages.getImageData(Long.parseLong(imageId)); com.itextpdf.text.Image itextImage = com.itextpdf.text.Image.getInstance(imageData); Paragraph caption = new Paragraph(imgName); caption.setAlignment(Element.ALIGN_CENTER); PdfPCell keyCell = new PdfPCell(new Phrase(label)); keyCell.setHorizontalAlignment(Element.ALIGN_CENTER); keyCell.setVerticalAlignment(Element.ALIGN_MIDDLE); keyCell.setPadding(10); currentTable.addCell(keyCell); PdfPCell valueCell = new PdfPCell(); valueCell.setHorizontalAlignment(Element.ALIGN_CENTER); valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE); valueCell.setPadding(10); valueCell.addElement(itextImage); valueCell.addElement(caption); currentTable.addCell(valueCell); } else if (type.equals(FormUtilities.TYPE_SKETCH)) { if (value.trim().length() == 0) { continue; } String[] imageIdsSplit = value.split(Note.IMAGES_SEPARATOR); for (String imageId : imageIdsSplit) { Image image = daoImages.getImage(Long.parseLong(imageId)); String imgName = image.getName(); byte[] imageData = daoImages.getImageData(Long.parseLong(imageId)); com.itextpdf.text.Image itextImage = com.itextpdf.text.Image.getInstance(imageData); Paragraph caption = new Paragraph(imgName); caption.setAlignment(Element.ALIGN_CENTER); PdfPCell keyCell = new PdfPCell(new Phrase(label)); keyCell.setHorizontalAlignment(Element.ALIGN_CENTER); keyCell.setVerticalAlignment(Element.ALIGN_MIDDLE); keyCell.setPadding(10); currentTable.addCell(keyCell); PdfPCell valueCell = new PdfPCell(); valueCell.setHorizontalAlignment(Element.ALIGN_CENTER); valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE); valueCell.setPadding(10); valueCell.addElement(itextImage); valueCell.addElement(caption); currentTable.addCell(valueCell); } } else { addKeyValueToTableRow(currentTable, label, value); } } } document.add(currentChapter); document.newPage(); } }
From source file:eu.geopaparazzi.plugins.pdfexport.PdfExportDialogFragment.java
License:Open Source License
private void addKeyValueToTableRow(PdfPTable table, String key, String value) { PdfPCell keyCell = new PdfPCell(new Phrase(key)); keyCell.setHorizontalAlignment(Element.ALIGN_CENTER); keyCell.setVerticalAlignment(Element.ALIGN_MIDDLE); keyCell.setPadding(10);/*w w w. j av a 2 s . co m*/ table.addCell(keyCell); PdfPCell valueCell = new PdfPCell(new Phrase(value)); valueCell.setHorizontalAlignment(Element.ALIGN_CENTER); valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE); valueCell.setPadding(10); table.addCell(valueCell); }
From source file:eyeofthetiger.utils.PDFDossardGenerator.java
private Phrase createCleanPhrase(String txt1, float fontSize1, boolean bold1) { Phrase phrase = new Phrase(txt1); phrase.getFont().setSize(fontSize1); if (bold1) {/*from w w w . j a v a 2s .c o m*/ phrase.getFont().setStyle(Font.BOLD); phrase.setLeading(fontSize1); } return phrase; }
From source file:file.PDFWriter.java
License:Open Source License
/** * Add the page number and line to the PDF * @param splitLines the array of line segments to print * @param page the page number the line was on * @throws DocumentException //from ww w . j a v a2 s .c om */ private void addLineTableToPDF(String[] splitLines, String page) throws DocumentException { PdfPTable lineTable = new PdfPTable(2); PdfPCell pageCell = new PdfPCell(new Paragraph("Page: " + page, lineFont)); pageCell.setPadding(20); pageCell.setPaddingLeft(0); pageCell.setBorder(PdfPCell.NO_BORDER); Chunk lineSegment1 = new Chunk(splitLines[0]); lineSegment1.setFont(lineFont); Chunk error1 = new Chunk(splitLines[1]); error1.setFont(lineFontBold); Chunk lineSegment2 = new Chunk(splitLines[2]); lineSegment2.setFont(lineFont); Chunk error2 = new Chunk(splitLines[3]); error2.setFont(lineFontBold); Chunk lineSegment3 = new Chunk(splitLines[4]); lineSegment3.setFont(lineFont); Phrase line = new Phrase(lineSegment1); line.add(error1); line.add(lineSegment2); line.add(error2); line.add(lineSegment3); PdfPCell lineCell = new PdfPCell(line); lineCell.setPadding(20); lineCell.setBorder(PdfPCell.NO_BORDER); lineTable.setWidthPercentage(100); lineTable.setWidths(new int[] { 2, 10 }); lineTable.setSpacingBefore(1f); lineTable.setSpacingAfter(1f); lineTable.addCell(pageCell); lineTable.addCell(lineCell); document.add(lineTable); document.add(Chunk.NEWLINE); }
From source file:fll.util.PdfUtils.java
License:Open Source License
/** * Create a table cell from the specified {@link Chunk}. *///ww w .j av a 2 s. co m public static PdfPCell createBasicCell(final Chunk chunk) throws BadElementException { final PdfPCell cell = new PdfPCell(new Phrase(chunk)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setUseDescender(true); return cell; }
From source file:fll.web.report.finalist.TeamFinalistSchedule.java
License:Open Source License
protected void processRequest(final HttpServletRequest request, final HttpServletResponse response, final ServletContext application, final HttpSession session) throws IOException, ServletException { Connection connection = null; try {/*from ww w . j av a 2s .co m*/ final DataSource datasource = ApplicationAttributes.getDataSource(application); connection = datasource.getConnection(); final ChallengeDescription challengeDescription = ApplicationAttributes .getChallengeDescription(application); // create simple doc and write to a ByteArrayOutputStream final Document document = new Document(PageSize.LETTER); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final PdfWriter writer = PdfWriter.getInstance(document, baos); writer.setPageEvent(new ReportPageEventHandler(HEADER_FONT, "Finalist Callback Schedule", challengeDescription.getTitle(), Queries.getCurrentTournamentName(connection))); document.open(); document.addTitle("Ranking Report"); // add content final int currentTournament = Queries.getCurrentTournament(connection); final Collection<String> divisions = FinalistSchedule.getAllDivisions(connection, currentTournament); final Collection<FinalistSchedule> schedules = new LinkedList<FinalistSchedule>(); for (final String division : divisions) { final FinalistSchedule schedule = new FinalistSchedule(connection, currentTournament, division); schedules.add(schedule); } final Map<Integer, TournamentTeam> tournamentTeams = Queries.getTournamentTeams(connection, currentTournament); final List<Integer> teamNumbers = new LinkedList<Integer>(tournamentTeams.keySet()); Collections.sort(teamNumbers); for (final int teamNum : teamNumbers) { final TournamentTeam team = tournamentTeams.get(teamNum); for (final FinalistSchedule schedule : schedules) { final List<FinalistDBRow> finalistTimes = schedule.getScheduleForTeam(teamNum); final Map<String, String> rooms = schedule.getRooms(); if (!finalistTimes.isEmpty()) { final Paragraph para = new Paragraph(); para.add(Chunk.NEWLINE); para.add(new Chunk("Finalist times for Team " + teamNum, TITLE_FONT)); para.add(Chunk.NEWLINE); para.add(new Chunk(team.getTeamName() + " / " + team.getOrganization(), TITLE_FONT)); para.add(Chunk.NEWLINE); para.add(new Chunk("Award Group: " + team.getAwardGroup(), TITLE_FONT)); para.add(Chunk.NEWLINE); para.add(Chunk.NEWLINE); final PdfPTable table = new PdfPTable(3); // table.getDefaultCell().setBorder(0); table.setWidthPercentage(100); table.addCell(new Phrase(new Chunk("Time", HEADER_FONT))); table.addCell(new Phrase(new Chunk("Room", HEADER_FONT))); table.addCell(new Phrase(new Chunk("Category", HEADER_FONT))); for (final FinalistDBRow row : finalistTimes) { final String categoryName = row.getCategoryName(); String room = rooms.get(categoryName); if (null == room) { room = ""; } table.addCell(new Phrase(String.format("%d:%02d", row.getHour(), row.getMinute()), VALUE_FONT)); table.addCell(new Phrase(new Chunk(room, VALUE_FONT))); table.addCell(new Phrase(new Chunk(categoryName, VALUE_FONT))); } // foreach row para.add(table); document.add(para); document.add(Chunk.NEXTPAGE); } // non-empty list of teams } // foreach schedule } // foreach team document.close(); // setting some response headers response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma", "public"); // setting the content type response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "filename=teamFinalistSchedule.pdf"); // the content length is needed for MSIE!!! response.setContentLength(baos.size()); // write ByteArrayOutputStream to the ServletOutputStream final ServletOutputStream out = response.getOutputStream(); baos.writeTo(out); out.flush(); } catch (final SQLException e) { LOG.error(e, e); throw new RuntimeException(e); } catch (final DocumentException e) { LOG.error(e, e); throw new RuntimeException(e); } finally { SQLFunctions.close(connection); } }
From source file:forensics_app.SharedModel.java
public static void writePDF(List<List<List>> final_result) { List<List> al = new ArrayList<List>(); Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD); Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.RED); Font blueFont = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.NORMAL, BaseColor.BLUE); Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD); Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); String fileName = System.getProperty("user.home") + "\\Desktop\\" + System.currentTimeMillis() + ".pdf"; Document document = null;//from w w w . jav a 2 s.co m document = new Document(); try { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileName)); document.open(); document.add(new Phrase("\n")); document.add(new Paragraph("ForEye Smart Report", redFont)); document.add(new Phrase("\n\n")); for (int z = 0; z < 3; z++) { al = final_result.get(z); switch (z) { case 0: if (al != null) { document.add(new Phrase("\n-> History\n", blueFont)); document.add(new Paragraph("This user interseted in " + al.get(0).get(0) + " by " + String.valueOf(al.get(1).get(0)) + "%", catFont)); document.add(new Phrase("\nthe rest of report\n", subFont)); for (int j = 0; j < al.get(0).size(); j++) { document.add(new Phrase( al.get(0).get(j) + " by " + String.valueOf(al.get(1).get(j)) + "%")); document.add(new Phrase("\n")); } document.add(new Phrase("\n\n")); } break; case 1: if (al != null) { document.add(new Phrase("\n-> Download\n", blueFont)); document.add(new Paragraph("This user interseted in " + al.get(0).get(0) + " by " + String.valueOf(al.get(1).get(0)) + "%", catFont)); document.add(new Phrase("\nthe rest of report\n", subFont)); for (int j = 0; j < al.get(0).size(); j++) { document.add(new Phrase( al.get(0).get(j) + " by " + String.valueOf(al.get(1).get(j)) + "%")); document.add(new Phrase("\n")); } document.add(new Phrase("\n\n")); } break; case 2: if (al != null) { document.add(new Phrase("\n-> Bookmarks\n", blueFont)); document.add(new Paragraph("This user interseted in " + al.get(0).get(0) + " by " + String.valueOf(al.get(1).get(0)) + "%", catFont)); document.add(new Phrase("\nthe rest of report\n", subFont)); for (int j = 0; j < al.get(0).size(); j++) { document.add(new Phrase( al.get(0).get(j) + " by " + String.valueOf(al.get(1).get(j)) + "%")); document.add(new Phrase("\n")); } document.add(new Phrase("\n\n")); } break; } } document.close(); writer.close(); if (Desktop.isDesktopSupported()) { try { File myFile = new File(fileName); Desktop.getDesktop().open(myFile); } catch (IOException ex) { // no application registered for PDFs } } } catch (DocumentException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
From source file:Forms.CloseCash.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed String sql = "SELECT * FROM `cash` WHERE 1"; Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy"); String date = "" + ft.format(dNow); File theDir = new File("E:\\Reports"); // if the directory does not exist, create it if (!theDir.exists()) { //System.out.println("creating directory: " + directoryName); boolean result = false; try {//from w w w . ja va2 s .co m theDir.mkdir(); result = true; } catch (SecurityException se) { //handle it } } try { Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/nafis", "root", ""); Statement s = (Statement) con.prepareStatement(sql); ResultSet rs = s.executeQuery(sql); Document document = new Document(PageSize.A5); PdfWriter.getInstance(document, new FileOutputStream("E:\\Reports\\report(" + date + ").pdf")); document.open(); Image image = Image.getInstance("api.png"); document.add(image); document.add(new Paragraph("UNITY POS REPORS", FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.BLUE))); document.add(new Paragraph(date, FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph( "--------------------------------------------------------------------------------------")); PdfPTable table = new PdfPTable(4); //table.addCell("Date"); //table.addCell("Cash In/Out"); PdfPCell cell = new PdfPCell(new Phrase("Date")); cell.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(cell); PdfPCell ce = new PdfPCell(new Phrase("Cash In/Out")); ce.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(ce); PdfPCell c = new PdfPCell(new Phrase("Cause")); c.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(c); PdfPCell cel = new PdfPCell(new Phrase("Amount")); cel.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(cel); document.add(new Paragraph(" ")); document.add(table); float in = 0, out = 0; while (rs.next()) { String dateof = rs.getString(5); String inout = rs.getString(2); String cause = rs.getString(3); String amount = rs.getString(4); if (inout.equalsIgnoreCase("Cash In")) { in = in + Float.parseFloat(amount); } else { out = out + Float.parseFloat(amount); } PdfPTable t = new PdfPTable(4); t.addCell(dateof); t.addCell(inout); t.addCell(cause); t.addCell(amount); document.add(t); } System.out.println("in=" + in + "out=" + out); document.add(new Paragraph(" ")); document.add(new Paragraph("Total Invested: " + out, FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph("Total Return: " + in, FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph("Total Earned: " + (in - out), FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph(" ")); document.add(new Paragraph( "--------------------------------------------------------------------------------------")); document.close(); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "problem in memoo"); } /////////////////////////// //to open pdf invoice try { Runtime.getRuntime() .exec("rundll32 url.dll,FileProtocolHandler " + "E:\\Reports\\report(" + date + ").pdf"); } catch (IOException ex) { Logger.getLogger(SellPage.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:fr.ensicaen.yousign.GenerePDF.java
public void genere() { try {//from w ww. j a v a2 s . c o m OutputStream file = new FileOutputStream(util.generePDFFilenameToUse()); Document document = new Document(); PdfWriter.getInstance(document, file); document.open(); // // Affichage du logo, de la date et l'heure et avec ou sans frais // document.add(addEntete()); // // Caractristiques du missionnaire (table: nom, prenom, courriel = 1re colonne, adresse = 2me colonne // PdfPTable tableIdentite = new PdfPTable(2); tableIdentite.setWidthPercentage(100); PdfPCell nomCell = new PdfPCell( new Phrase(new Chunk("Nom: " + util.getOrdreMission().getNomMissionnaire() + "\n" + "Prenom: " + util.getOrdreMission().getPrenomMissionnaire() + "\n\n" + "Courriel: " + util.getOrdreMission().getEmailMissionnaire(), fontItemSection))); nomCell.setBorder(Rectangle.NO_BORDER); tableIdentite.addCell(nomCell); Chunk adresseChunk = new Chunk("Adresse: " + "\n" + util.getOrdreMission().getRueMissionnaire() + "\n" + util.getOrdreMission().getCodepostalMissionnaire() + " " + util.getOrdreMission().getVilleMissionnaire() + "\n" + util.getOrdreMission().getPaysMissionnaire(), fontItemSection); PdfPCell adresseCell = new PdfPCell(new Phrase(adresseChunk)); adresseCell.setBorder(Rectangle.NO_BORDER); tableIdentite.addCell(adresseCell); Paragraph identite; identite = new Paragraph(); addEmptyLine(identite, 1); identite.add(tableIdentite); document.add(identite); // // Numero IBAN // Paragraph iban = new Paragraph(); addEmptyLine(iban, 1); iban.add(new Chunk("Numro IBAN: " + util.getOrdreMission().getIban1() + " " + util.getOrdreMission().getIban2() + " " + util.getOrdreMission().getIban3() + " " + util.getOrdreMission().getIban4() + " " + util.getOrdreMission().getIban5() + " " + util.getOrdreMission().getIban6() + " " + util.getOrdreMission().getIban7(), fontItemSection)); document.add(iban); // // Motif de la mission // Paragraph mission = new Paragraph(); addEmptyLine(mission, 1); mission.add( new Chunk("Motif de la mission: " + util.getOrdreMission().getMotifMission(), fontItemSection)); addEmptyLine(mission, 1); // // Dtails de la mission (lieu, dates, ...) // PdfPTable tableMission = new PdfPTable(7); tableMission.setWidthPercentage(100); float[] columnWidths = { 1f, 2f, 1.5f, 1f, 2f, 1.5f, 1f }; tableMission.setWidths(columnWidths); PdfPCell cell; // // Ligne d'entete du tableau des dtails de la mission // tableMission.addCell(""); cell = new PdfPCell(new Phrase("Lieu de dpart")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase("Date")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase("Heure")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase("Lieu d'arrive")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase("Date")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase("Heure")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); // // description du voyage aller // tableMission.addCell("Aller"); cell = new PdfPCell(new Phrase(util.getOrdreMission().getLieuDepartAller())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getDateDepartAller())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getHeureDepartAller() + ":" + util.getOrdreMission().getMinuteDepartAller())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getLieuArriveeAller())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getDateArriveeAller())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getHeureArriveeAller() + ":" + util.getOrdreMission().getMinuteArriveeAller())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); // // Description du voyage retour // tableMission.addCell("Retour"); cell = new PdfPCell(new Phrase(util.getOrdreMission().getLieuDepartRetour())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getDateDepartRetour())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getHeureDepartRetour() + ":" + util.getOrdreMission().getMinuteDepartRetour())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getLieuArriveeRetour())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getDateArriveeRetour())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); cell = new PdfPCell(new Phrase(util.getOrdreMission().getHeureArriveeRetour() + ":" + util.getOrdreMission().getMinuteArriveeRetour())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableMission.addCell(cell); mission.add(tableMission); document.add(mission); // // Moyens de transport // Paragraph moyensTransport = new Paragraph(); addEmptyLine(moyensTransport, 1); moyensTransport.add(new Chunk("Moyens de transport utiliss\n", fontTitleSection)); if (util.use("Passager")) { moyensTransport.add(new Chunk("Pas de frais de transport comme passager de la voiture de: " + util.getOrdreMission().getNomConducteur() + "\n", fontItemSection)); } if (util.use("Train")) { moyensTransport.add(new Chunk("Train: Classe: " + util.getOrdreMission().getTrainClasse() + " Prix des billets: " + util.getOrdreMission().getTrainPrixBillet() + " Bon de commande: " + util.getOrdreMission().getTrainBonCommande() + " Carte affaire: " + util.getOrdreMission().getTrainCarteAffaire() + "\n", fontItemSection)); } if (util.use("Avion_Bateau")) { moyensTransport.add(new Chunk( "Avion ou Bateau: Classe: " + util.getOrdreMission().getAvionBateauClasse() + " Prix des billets: " + util.getOrdreMission().getAvionBateauPrixBillet() + " Bon de commande: " + util.getOrdreMission().getAvionBateauBonCommande() + " Carte affaire: " + util.getOrdreMission().getAvionBateauCarteAffaire() + "\n", fontItemSection)); } if (util.use("Vehicule_Service")) { moyensTransport.add(new Chunk( "Voiture de service: " + util.getOrdreMission().getVehiculeService() + " Nombre de kilomtres: " + util.getOrdreMission().getVehiculeServiceNombreKilometres() + "\n", fontItemSection)); moyensTransport.add(new Chunk( "Nom des passagers: " + util.getOrdreMission().getVehiculeServiceNomPassagers() + "\n", fontItemSection)); } if (util.use("Vehicule_Personnel")) { moyensTransport.add(new Chunk( "En vertu du dcret No 2006-781 du 3 juillet 2006: je soussign, " + util.getOrdreMission().getPrenomMissionnaire() + " " + util.getOrdreMission().getNomMissionnaire() + ", sollicite l'autorisation ", fontItemSection)); moyensTransport.add(new Chunk("d'utiliser mon vhicule de marque " + util.getOrdreMission().getVehiculePersonnelMarque() + ", de puissance " + util.getOrdreMission().getVehiculePersonnelPuissance() + ", d'immatriculation: " + util.getOrdreMission().getVehiculePersonnelImmatriculation(), fontItemSection)); moyensTransport.add(new Chunk( ", de date d'acquisition " + util.getOrdreMission().getVehiculePersonnelDateAcquisition() + " pour me rendre " + util.getOrdreMission().getLieuArriveeAller(), fontItemSection)); moyensTransport.add(new Chunk(" et dclare avoir souscrit auprs de " + util.getOrdreMission().getVehiculePersonnelNomAssureur() + " une police d'assurance garantissant de manire illimite ma responsabilit personnelle aux termes ", fontItemSection)); moyensTransport.add(new Chunk( "des articles 1382, 1383, 1384 du Code Civil, ainsi qu'ventuellement la responsabilit de l'Etat, y compris le cas o celle-ci est engage vis--vis des personnes transportes. ", fontItemSection)); moyensTransport .add(new Chunk("Cette police comprend l'assurance contentieuse.\n", fontItemSection)); moyensTransport.add(new Chunk( "DECLARATION COMPLEMENTAIRE: je certifie avoir contract l'assurance complmentaire couvrant tous les risques non compris dans l'assurance obligatoire.\n", fontItemSection)); } addEmptyLine(moyensTransport, 1); if (util.use("taxi")) { moyensTransport.add( new Chunk("Le Directeur autorise le remboursement d'un taxi " + "\n", fontItemSection)); } if (util.use("vehicule_location")) { moyensTransport .add(new Chunk("Le Directeur autorise le remboursement d'un vhicule de location " + "\n", fontItemSection)); } if (util.use("Vehicule_Service") || util.use("Vehicule_Personnel") || util.use("vehicule_location")) { moyensTransport .add(new Chunk( "\nJustication de l'utilisation du vhicule personnel ou de la location:" + util.getOrdreMission().getVehiculeJustificatif() + "\n", fontItemSection)); moyensTransport.add( new Chunk("\nJe certifie tre en possession du permis de conduire depuis plus d'un an\n", fontBoldItemSection)); } document.add(moyensTransport); // // Frais annexe // Paragraph fraisAnnexe = new Paragraph(); addEmptyLine(fraisAnnexe, 1); fraisAnnexe.add(new Chunk("Frais Annexe\n", fontTitleSection)); fraisAnnexe.add(new Chunk("Frais d'inscription: " + util.getOrdreMission().getFraisInscription() + " Montant: " + util.getOrdreMission().getMontantInscription() + " ", fontItemSection)); document.add(fraisAnnexe); Paragraph avance = new Paragraph(); addEmptyLine(avance, 1); avance.add(new Chunk("Avance: ", fontTitleSection)); avance.add(new Chunk(util.getOrdreMission().getAvance(), fontItemSection)); document.add(avance); // // Informations financieres // Paragraph finance = new Paragraph(); addEmptyLine(finance, 1); finance.add(new Chunk("Informations financires\n", fontTitleSection)); finance.add(new Chunk("Centre financier: " + util.getOrdreMission().getCentreFinancier() + " Projet ou eOTP: " + util.getOrdreMission().getProjet() + "\n", fontItemSection)); finance.add(new Chunk("Responsable financier: " + util.getOrdreMission().getPrenomResponsableFinancier() + " " + util.getOrdreMission().getNomResponsableFinancier() + "\n", fontItemSection)); finance.add( new Chunk("Autorit hirarchique: " + util.getOrdreMission().getPrenomAutoriteHierarchique() + " " + util.getOrdreMission().getNomAutoriteHierarchique(), fontItemSection)); document.add(finance); // // Informations complementaires eventuelles // if (util.getOrdreMission().getInformationsComplementaires() != null) { Paragraph informationsComplementaires = new Paragraph(); informationsComplementaires.add(new Chunk("\nInformations complementaires: ", fontTitleSection)); informationsComplementaires .add(new Chunk(util.getOrdreMission().getInformationsComplementaires(), fontItemSection)); document.add(informationsComplementaires); } document.close(); file.close(); } catch (DocumentException | IOException e) { System.err .println("Erreur a la generation du fichier " + util.getPdfFileName() + ": " + e.getMessage()); } }