List of usage examples for com.itextpdf.text.pdf PdfPTable setWidthPercentage
public void setWidthPercentage(final float widthPercentage)
From source file:utils.pdf.cv_templates.Template4.java
private void addProfessionalExperience(List<ProfessionalExperience> experienceList) throws DocumentException { Paragraph paragraph;/*from w w w .j ava 2s . co m*/ PdfPCell cell; PdfPTable table; for (int i = 0; i < experienceList.size(); i++) { table = new PdfPTable(new float[] { 1f, 2.25f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); if (i == 0) { paragraph = new Paragraph("EXPERIENCIA PROFESIONAL", font1); cell.setBorder(PdfPCell.RIGHT); } else { paragraph = new Paragraph(""); } paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(""); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Ttulo", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(experienceList.get(i).job, font2); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Empresa y lugar", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(experienceList.get(i).company, font2); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Fecha", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(experienceList.get(i).startDate + " - " + experienceList.get(i).endDate, font2); cell.addElement(paragraph); table.addCell(cell); document.add(table); } }
From source file:utils.pdf.cv_templates.Template4.java
private void addStudies(User user) throws DocumentException { Paragraph paragraph;/* w w w . j a va 2 s. c om*/ PdfPCell cell; PdfPTable table; table = new PdfPTable(new float[] { 1f, 2.25f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); if (!user.studyTitle.equals("")) { paragraph = new Paragraph("EXPERIENCIA ACADMICA", font1); cell.setBorder(PdfPCell.RIGHT); } else { paragraph = new Paragraph(""); } paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(""); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Ttulo", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(user.studyTitle, font2); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Centro y lugar", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(user.studyLocation, font2); cell.addElement(paragraph); table.addCell(cell); document.add(table); }
From source file:utils.pdf.cv_templates.Template4.java
private void addSoftware(List<Software> softwareList) throws DocumentException { Paragraph paragraph;/*from ww w.ja v a 2 s. c om*/ PdfPCell cell; PdfPTable table; for (int i = 0; i < softwareList.size(); i++) { table = new PdfPTable(new float[] { 1f, 2.25f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); if (i == 0) { paragraph = new Paragraph("PROGRAMAS INFORM?TICOS", font1); cell.setBorder(PdfPCell.RIGHT); } else { paragraph = new Paragraph(""); } paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(""); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Nombre", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(softwareList.get(i).software, font2); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Nivel", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(softwareList.get(i).level, font2); cell.addElement(paragraph); table.addCell(cell); document.add(table); } }
From source file:utils.pdf.cv_templates.Template4.java
private void addCourses(List<Course> courseList) throws DocumentException { Paragraph paragraph;//from www. java 2s. c o m PdfPCell cell; PdfPTable table; for (int i = 0; i < courseList.size(); i++) { table = new PdfPTable(new float[] { 1f, 2.25f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); if (i == 0) { paragraph = new Paragraph("CURSOS", font1); cell.setBorder(PdfPCell.RIGHT); } else { paragraph = new Paragraph(""); } paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(""); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Ttulo", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(courseList.get(i).name, font2); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Centro y lugar", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(courseList.get(i).company, font2); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Nmero de horas", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(courseList.get(i).length, font2); cell.addElement(paragraph); table.addCell(cell); document.add(table); } }
From source file:utils.pdf.cv_templates.Template4.java
private void addLanguage(List<Language> languageList) throws DocumentException { Paragraph paragraph;//w ww . ja v a 2 s .com PdfPCell cell; PdfPTable table; for (int i = 0; i < languageList.size(); i++) { table = new PdfPTable(new float[] { 1f, 2.25f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); if (i == 0) { paragraph = new Paragraph("IDIOMAS", font1); cell.setBorder(PdfPCell.RIGHT); } else { paragraph = new Paragraph(""); } paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(""); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Nombre", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(languageList.get(i).language, font2); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.RIGHT); paragraph = new Paragraph("Nivel", font2); cell.setBorder(PdfPCell.RIGHT); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(10); cell.setPaddingTop(0); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(languageList.get(i).level, font2); cell.addElement(paragraph); table.addCell(cell); document.add(table); } }
From source file:utils.pdf.cv_templates.Template4.java
private void addSkills(User user, List<String> personalCharacteristics, List<Skill> skills) throws DocumentException { Paragraph paragraph;/* w w w . ja v a 2s . c om*/ PdfPCell cell; PdfPTable table; List<String> rankedSkills = selectSkills(skills); if (personalCharacteristics.size() != 0 && rankedSkills.size() != 0) { table = new PdfPTable(new float[] { 1f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph("HABILIDADES PERSONALES", font1); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph( "Me defino como una persona de carcter " + personalCharacteristics.get(1).toLowerCase() + " y " + personalCharacteristics.get(0).toLowerCase() + ".", font2); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph("Entre mis puntos fuertes destacan las " + rankedSkills.get(0).toLowerCase() + " y las " + rankedSkills.get(1).toLowerCase() + ".", font2); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph( "Considero que soy una persona activa que presenta " + rankedSkills.get(2).toLowerCase() + ".", font2); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph("Adems, una de las caractersticas que me define es que soy " + personalCharacteristics.get(2).toLowerCase() + ".", font2); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); if (!user.drivingLicense.equals("No tengo carnet")) { //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph("Permiso de conducir: " + user.drivingLicense + ".", font2); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); } document.add(table); } }
From source file:utils.PrintUtils.java
public static void printAnnualReportNote(Annee annee, Trimesteannee trimesteannee, Classe classe, ClasseElementevaluation classeElementevaluation, List<Eleveanneeclasse> eleveanneeclasses, List<Trimesteannee> trimesteannees, List<Sequenceannee> sequenceannees, ClasseElementevaluationFacadeLocal classeElementevaluationFacadeLocal, PlanningEvaluationFacadeLocal planningEvaluationFacadeLocal, EvaluationFacadeLocal evaluationFacadeLocal, SequenceanneeFacadeLocal sequenceanneeFacadeLocal) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); String fichier = "proces_verbal_note" + "_" + annee.getCode() + "-" + annee.getCodefin() + "_" + classe.getNom() + ".pdf"; Document rapport = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(rapport, new FileOutputStream( Utilitaires.path + "/" + Utilitaires.repertoireParDefaultNotesAnnuel + "/" + fichier)); rapport.open();/*from w ww .j a v a 2s .c o m*/ rapport.add(new Paragraph("Anne Scolaire : " + annee.getCode() + " / " + annee.getCodefin())); rapport.add(new Paragraph("Classe : " + classe.getNom())); rapport.add( new Paragraph("Unit Evaluation : " + classeElementevaluation.getElementevaluation().getNom())); rapport.add(new Paragraph("Periode : " + annee.getCode() + " - " + annee.getCodefin())); rapport.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(2 + sequenceannees.size()); table.setWidthPercentage(100); table.addCell(PrintUtils.createPdfPCell("PROCES VERBAL ANNUEL DES NOTES ", 2 + sequenceannees.size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("ELEVES", 2, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))).setRowspan(2); table.addCell(PrintUtils.createPdfPCell("NOTES", sequenceannees.size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Trimesteannee t : trimesteannees) { table.addCell(PrintUtils.createPdfPCell("" + t.getIdtrimestre().getNom(), sequenceanneeFacadeLocal.getByTrimestre(t.getIdtrimestrean()).size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } table.addCell(PrintUtils.createPdfPCell("MATRICULE", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("NOM(S) ET PRENOM(S)", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Sequenceannee s : sequenceannees) { table.addCell(PrintUtils.createPdfPCell("" + s.getIdsequence().getNom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } for (Eleveanneeclasse e : eleveanneeclasses) { table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getMatricule(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getNom() + " " + e.getEleve().getPrenom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Sequenceannee s1 : sequenceannees) { String r = findNote1(e, s1, classeElementevaluation, classeElementevaluationFacadeLocal, planningEvaluationFacadeLocal, evaluationFacadeLocal); table.addCell(PrintUtils.createPdfPCell("" + r, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } } rapport.add(table); rapport.close(); }
From source file:utils.PrintUtils.java
public static void printTrimestrialReportNote(Annee annee, Trimesteannee trimesteannee, Classe classe, ClasseElementevaluation classeElementevaluation, List<Eleveanneeclasse> eleveanneeclasses, List<Sequenceannee> sequenceannees, ClasseElementevaluationFacadeLocal classeElementevaluationFacadeLocal, PlanningEvaluationFacadeLocal planningEvaluationFacadeLocal, EvaluationFacadeLocal evaluationFacadeLocal) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); String fichier = "proces_verbal_note" + "_" + trimesteannee.getIdtrimestre().getNom() + "_" + classe.getNom() + ".pdf"; Document rapport = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(rapport, new FileOutputStream( Utilitaires.path + "/" + Utilitaires.repertoireParDefaultNotesTrim + "/" + fichier)); rapport.open();//from ww w . j a v a2 s. c om rapport.add(new Paragraph("Anne Scolaire : " + annee.getCode() + " / " + annee.getCodefin())); rapport.add(new Paragraph("Classe : " + classe.getNom())); rapport.add( new Paragraph("Unit Evaluation : " + classeElementevaluation.getElementevaluation().getNom())); rapport.add(new Paragraph("Priode : " + trimesteannee.getIdtrimestre().getNom())); rapport.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(2 + sequenceannees.size()); table.setWidthPercentage(100); table.addCell(PrintUtils.createPdfPCell("PROCES VERBAL TRIMESTRIEL DES NOTES ", 2 + sequenceannees.size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("ELEVES", 2, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("NOTES", sequenceannees.size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("MATRICULE", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("NOM(S) ET PRENOM(S)", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Sequenceannee s : sequenceannees) { table.addCell(PrintUtils.createPdfPCell("" + s.getIdsequence().getNom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } for (Eleveanneeclasse e : eleveanneeclasses) { table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getMatricule(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getNom() + " " + e.getEleve().getPrenom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Sequenceannee s1 : sequenceannees) { String r = findNote1(e, s1, classeElementevaluation, classeElementevaluationFacadeLocal, planningEvaluationFacadeLocal, evaluationFacadeLocal); table.addCell(PrintUtils.createPdfPCell("" + r, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } } rapport.add(table); rapport.close(); }