List of usage examples for com.itextpdf.text Paragraph setAlignment
public void setAlignment(int alignment)
From source file:utils.pdf.cv_templates.Template1.java
private void addAllTitle(List<Language> languageList, List<Course> courseList) throws DocumentException { Paragraph paragraph1; Paragraph paragraph2;//from w w w. j a v a 2s . c om PdfPCell cell; PdfPTable table; table = new PdfPTable(new float[] { 0.85f, 1.7f, 0.6f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); for (int i = 0; i < languageList.size(); i++) { cell.setBorder(PdfPCell.NO_BORDER); if (i == 0) { paragraph1 = new Paragraph("Idiomas:", font1); paragraph2 = new Paragraph( languageList.get(i).language + "." + " Nivel: " + languageList.get(i).level, font2); cell.setBorder(PdfPCell.NO_BORDER); } else { paragraph1 = new Paragraph(""); paragraph2 = new Paragraph( languageList.get(i).language + "." + " Nivel: " + languageList.get(i).level, font2); } paragraph1.setAlignment(Paragraph.ALIGN_LEFT); paragraph2.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); cell.addElement(paragraph1); cell.addElement(paragraph2); } table.addCell(cell); //First column cell = new PdfPCell(); for (int j = 0; j < courseList.size(); j++) { cell.setBorder(PdfPCell.NO_BORDER); if (j == 0) { paragraph1 = new Paragraph("Cursos:", font1); paragraph2 = new Paragraph( courseList.get(j).name + "." + " Expedido por: " + courseList.get(j).company, font2); cell.setBorder(PdfPCell.NO_BORDER); } else { paragraph1 = new Paragraph(""); paragraph2 = new Paragraph( courseList.get(j).name + "." + " Expedido por: " + courseList.get(j).company, font2); } paragraph1.setAlignment(Paragraph.ALIGN_LEFT); paragraph2.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); cell.addElement(paragraph1); cell.addElement(paragraph2); } table.addCell(cell); //First column cell = new PdfPCell(); for (int j = 0; j < courseList.size(); j++) { cell.setBorder(PdfPCell.NO_BORDER); if (j == 0) { paragraph1 = new Paragraph(" ", font1); paragraph2 = new Paragraph(courseList.get(j).length + " Horas", font3); cell.setBorder(PdfPCell.NO_BORDER); } else { paragraph1 = new Paragraph(""); paragraph2 = new Paragraph(courseList.get(j).length + " Horas", font3); } paragraph1.setAlignment(Paragraph.ALIGN_LEFT); paragraph2.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); cell.addElement(paragraph1); cell.addElement(paragraph2); } table.addCell(cell); document.add(table); }
From source file:utils.pdf.cv_templates.Template2.java
private void addPersonalInformation(User user) throws DocumentException { Paragraph paragraph; PdfPCell cell;/*from w w w . j a v a 2 s .c om*/ PdfPTable table; table = new PdfPTable(new float[] { 0.5f, 2f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(" "); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(55); cell.setPaddingTop(0); paragraph = new Paragraph(user.name.toUpperCase() + " " + user.surnames.toUpperCase(), font1); cell.setBorder(PdfPCell.NO_BORDER); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(" "); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(55); cell.setPaddingTop(0); paragraph = new Paragraph(user.birthDate + "\n", font2); cell.setBorder(PdfPCell.NO_BORDER); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(" "); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(55); cell.setPaddingTop(0); paragraph = new Paragraph(user.phoneNumber, font2); paragraph.setSpacingBefore(20); cell.setBorder(PdfPCell.NO_BORDER); cell.addElement(paragraph); table.addCell(cell); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(" "); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(55); cell.setPaddingTop(0); paragraph = new Paragraph(user.email, font2); paragraph.setSpacingBefore(20); cell.setBorder(PdfPCell.NO_BORDER); cell.addElement(paragraph); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph(" "); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_RIGHT); cell.setPaddingRight(10); cell.addElement(paragraph); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(55); cell.setPaddingTop(0); if (!user.drivingLicense.equals("No tengo carnet")) { paragraph = new Paragraph("\nPermiso de conducir: " + user.drivingLicense, font2); paragraph.setAlignment(paragraph.ALIGN_LEFT); cell.addElement(paragraph); } table.addCell(cell); document.add(table); }
From source file:utils.pdf.cv_templates.Template2.java
private void addProfessionalExperience(List<ProfessionalExperience> experienceList) throws DocumentException { Paragraph paragraph; PdfPCell cell;//from w w w . j a v a2 s .c om PdfPTable table; for (int i = 0; i < experienceList.size(); i++) { table = new PdfPTable(new float[] { 1f, 0.5f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); if (i == 0) { paragraph = new Paragraph("Practicas: ", font5); cell.setBorder(PdfPCell.NO_BORDER); } else { paragraph = new Paragraph(""); } paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); 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.NO_BORDER); paragraph = new Paragraph(experienceList.get(i).job + "." + " " + experienceList.get(i).company, font6); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); 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, font6); cell.addElement(paragraph); table.addCell(cell); document.add(table); } }
From source file:utils.pdf.cv_templates.Template2.java
private void addStudies(User user) throws DocumentException { Paragraph paragraph; PdfPCell cell;/*from w w w . j ava2s. c o m*/ PdfPTable table; if (!user.studyTitle.equals("")) { 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(user.studyTitle + ".", font4); cell.setBorder(PdfPCell.NO_BORDER); paragraph.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); 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, font6); cell.addElement(paragraph); table.addCell(cell); document.add(table); } }
From source file:utils.pdf.cv_templates.Template2.java
private void addSoftware(List<Software> softwareList) throws DocumentException { Paragraph paragraph1; Paragraph paragraph2;//from w ww . j a va 2s . c om PdfPCell cell; PdfPTable table; table = new PdfPTable(new float[] { 1f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); for (int i = 0; i < softwareList.size(); i++) { cell.setBorder(PdfPCell.NO_BORDER); if (i == 0) { paragraph1 = new Paragraph("Programas informticos:", font5); paragraph2 = new Paragraph( softwareList.get(i).software + "." + " Nivel: " + softwareList.get(i).level, font6); cell.setBorder(PdfPCell.NO_BORDER); } else { paragraph1 = new Paragraph(""); paragraph2 = new Paragraph( softwareList.get(i).software + "." + " Nivel: " + softwareList.get(i).level, font6); } paragraph1.setAlignment(Paragraph.ALIGN_LEFT); paragraph2.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); cell.addElement(paragraph1); cell.addElement(paragraph2); } table.addCell(cell); document.add(table); }
From source file:utils.pdf.cv_templates.Template2.java
private void addAllTitle(List<Language> languageList, List<Course> courseList) throws DocumentException { Paragraph paragraph1; Paragraph paragraph2;//w w w .j a va 2 s .com PdfPCell cell; PdfPTable table; table = new PdfPTable(new float[] { 0.85f, 1.7f, 0.6f }); table.setWidthPercentage(100); table.setSpacingBefore(5); //First column cell = new PdfPCell(); for (int i = 0; i < languageList.size(); i++) { cell.setBorder(PdfPCell.NO_BORDER); if (i == 0) { paragraph1 = new Paragraph("Idiomas:", font5); paragraph2 = new Paragraph( languageList.get(i).language + "." + " Nivel: " + languageList.get(i).level, font6); cell.setBorder(PdfPCell.NO_BORDER); } else { paragraph1 = new Paragraph(""); paragraph2 = new Paragraph( languageList.get(i).language + "." + " Nivel: " + languageList.get(i).level, font6); } paragraph1.setAlignment(Paragraph.ALIGN_LEFT); paragraph2.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); cell.addElement(paragraph1); cell.addElement(paragraph2); } table.addCell(cell); //First column cell = new PdfPCell(); for (int j = 0; j < courseList.size(); j++) { cell.setBorder(PdfPCell.NO_BORDER); if (j == 0) { paragraph1 = new Paragraph("Cursos:", font5); paragraph2 = new Paragraph( courseList.get(j).name + "." + " Expedido por: " + courseList.get(j).company, font6); cell.setBorder(PdfPCell.NO_BORDER); } else { paragraph1 = new Paragraph(""); paragraph2 = new Paragraph( courseList.get(j).name + "." + " Expedido por: " + courseList.get(j).company, font6); } paragraph1.setAlignment(Paragraph.ALIGN_LEFT); paragraph2.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); cell.addElement(paragraph1); cell.addElement(paragraph2); } table.addCell(cell); //First column cell = new PdfPCell(); for (int j = 0; j < courseList.size(); j++) { cell.setBorder(PdfPCell.NO_BORDER); if (j == 0) { paragraph1 = new Paragraph(" ", font1); paragraph2 = new Paragraph(courseList.get(j).length + " Horas", font6); cell.setBorder(PdfPCell.NO_BORDER); } else { paragraph1 = new Paragraph(""); paragraph2 = new Paragraph(courseList.get(j).length + " Horas", font6); } paragraph1.setAlignment(Paragraph.ALIGN_LEFT); paragraph2.setAlignment(Paragraph.ALIGN_LEFT); cell.setPaddingRight(10); cell.setPaddingLeft(35); cell.addElement(paragraph1); cell.addElement(paragraph2); } table.addCell(cell); document.add(table); }
From source file:utils.pdf.cv_templates.Template3.java
private void addPersonalInformation(User user) throws DocumentException, IOException { Paragraph paragraph; PdfPCell cell;/*from w ww. j ava 2 s .c om*/ PdfPTable table; Image photo_img; if (!user.photo.id.equals("")) { photo_img = Image .getInstance(String.format("https://s3.amazonaws.com/aunclickdelempleo2/" + user.photo.id)); } else { photo_img = Image.getInstance(String.format("public/images/orientation/photo/ic_profile.png")); } table = new PdfPTable(new float[] { 3, 7 }); table.setWidthPercentage(100); //First column cell = new PdfPCell(); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingRight(15); cell.setPaddingLeft(50); cell.setPaddingTop(30); photo_img.setBorder(Image.BOX); photo_img.setBorderColor(BaseColor.WHITE); photo_img.scaleToFit(1000, 115); cell.addElement(photo_img); table.addCell(cell); //Second column cell = new PdfPCell(); cell.setPaddingLeft(55); cell.setPaddingTop(19); cell.setBorder(PdfPCell.NO_BORDER); paragraph = new Paragraph("Datos Personales", font1); paragraph.setAlignment(paragraph.ALIGN_LEFT); cell.addElement(paragraph); paragraph = new Paragraph(user.name + " " + user.surnames, font2); paragraph.setAlignment(paragraph.ALIGN_LEFT); paragraph.setSpacingBefore(8); cell.addElement(paragraph); paragraph = new Paragraph(user.birthDate, font3); paragraph.setAlignment(paragraph.ALIGN_LEFT); cell.addElement(paragraph); paragraph = new Paragraph("Calle " + user.residenceAddress + ", N " + user.residenceNumber + ", Ciudad " + user.residenceCity, font3); paragraph.setAlignment(paragraph.ALIGN_LEFT); cell.addElement(paragraph); paragraph = new Paragraph("Telfono: " + user.phoneNumber, font3); paragraph.setAlignment(paragraph.ALIGN_LEFT); cell.addElement(paragraph); paragraph = new Paragraph(user.email, font3); paragraph.setAlignment(paragraph.ALIGN_LEFT); cell.addElement(paragraph); if (!user.drivingLicense.equals("No tengo carnet")) { paragraph = new Paragraph("Permiso de conducir: " + user.drivingLicense, font3); paragraph.setAlignment(paragraph.ALIGN_LEFT); paragraph.setSpacingBefore(10); cell.addElement(paragraph); } table.addCell(cell); document.add(table); }
From source file:utils.pdf.cv_templates.Template3.java
private void addAcademicExperience(User user) throws DocumentException, IOException { Paragraph paragraph1, paragraph2; PdfPCell cell1, cell2, cell3;//from w w w.j a va 2s. c o m PdfPTable table1, table2, table3; // TABLE 1 table1 = new PdfPTable(new float[] { 5 }); table1.setWidthPercentage(100); cell1 = new PdfPCell(); cell1.setBorder(PdfPCell.NO_BORDER); cell1.setPaddingRight(15); cell1.setPaddingLeft(50); cell1.setPaddingTop(15); paragraph1 = new Paragraph("Experiencia acadmica", font1); paragraph1.setAlignment(paragraph1.ALIGN_LEFT); cell1.addElement(paragraph1); table1.addCell(cell1); document.add(table1); // TABLE 2 table2 = new PdfPTable(new float[] { 9, 1 }); table2.setWidthPercentage(100); // First column cell2 = new PdfPCell(); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setPaddingTop(5); Image long_line_img = Image.getInstance(LONG_LINE_IMAGE); long_line_img.setBorderWidth(10); long_line_img.setBorderColor(BaseColor.WHITE); long_line_img.scaleToFit(475, 50); cell2.addElement(long_line_img); //cell2.setBorderColor(Constants.COLOR_BLUE_T3); //cell2.setBorderWidthTop(2); table2.addCell(cell2); // Second column cell2 = new PdfPCell(); cell2.setBorder(PdfPCell.NO_BORDER); table2.addCell(cell2); document.add(table2); // TABLE 3 table3 = new PdfPTable(new float[] { 5 }); table3.setWidthPercentage(100); cell3 = new PdfPCell(); cell3.setBorder(PdfPCell.NO_BORDER); cell3.setPaddingRight(15); cell3.setPaddingLeft(50); cell3.setPaddingTop(-1); paragraph2 = new Paragraph(user.studyTitle.toUpperCase() + ".\n" + user.studyLocation.toUpperCase() + ".", font3); paragraph2.setAlignment(paragraph2.ALIGN_LEFT); cell3.addElement(paragraph2); table3.addCell(cell3); document.add(table3); }
From source file:utils.pdf.cv_templates.Template3.java
private void addProfessionalExperience(List<ProfessionalExperience> experienceList) throws DocumentException, IOException { Paragraph paragraph1, paragraph2; PdfPCell cell1, cell2, cell3;/*from ww w . j ava 2 s . c o m*/ PdfPTable table1, table2, table3; // TABLE 1 table1 = new PdfPTable(new float[] { 5 }); table1.setWidthPercentage(100); cell1 = new PdfPCell(); cell1.setBorder(PdfPCell.NO_BORDER); cell1.setPaddingRight(15); cell1.setPaddingLeft(50); cell1.setPaddingTop(15); paragraph1 = new Paragraph("Experiencia Profesional", font1); paragraph1.setAlignment(paragraph1.ALIGN_LEFT); cell1.addElement(paragraph1); table1.addCell(cell1); document.add(table1); // TABLE 2 table2 = new PdfPTable(new float[] { 9, 1 }); table2.setWidthPercentage(100); // First column cell2 = new PdfPCell(); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setPaddingTop(5); Image long_line_img = Image.getInstance(LONG_LINE_IMAGE); long_line_img.setBorderWidth(10); long_line_img.setBorderColor(BaseColor.WHITE); long_line_img.scaleToFit(475, 50); cell2.addElement(long_line_img); table2.addCell(cell2); // Second column cell2 = new PdfPCell(); cell2.setBorder(PdfPCell.NO_BORDER); table2.addCell(cell2); document.add(table2); // TABLE 3 for (int i = 0; i < experienceList.size(); i++) { table3 = new PdfPTable(new float[] { 6, 4 }); table3.setWidthPercentage(100); //First column cell3 = new PdfPCell(); cell3.setBorder(PdfPCell.NO_BORDER); cell3.setPaddingRight(15); cell3.setPaddingLeft(50); if (i == 0) { cell3.setPaddingTop(-1); } paragraph2 = new Paragraph(experienceList.get(i).job.toUpperCase() + ".\n" + experienceList.get(i).company.toUpperCase() + ".", font3); paragraph2.setSpacingBefore(10); cell3.addElement(paragraph2); table3.addCell(cell3); //Second column cell3 = new PdfPCell(); cell3.setBorder(PdfPCell.NO_BORDER); cell3.setPaddingRight(15); cell3.setPaddingLeft(50); if (i == 0) { cell3.setPaddingTop(-1); } paragraph2 = new Paragraph(experienceList.get(i).startDate.toUpperCase() + " - " + experienceList.get(i).endDate.toUpperCase() + ".", font3); paragraph2.setAlignment(paragraph2.ALIGN_LEFT); cell3.addElement(paragraph2); table3.addCell(cell3); document.add(table3); } }
From source file:utils.pdf.cv_templates.Template3.java
private void addSoftware(List<Software> softwareList) throws DocumentException, IOException { Paragraph paragraph1, paragraph2; PdfPCell cell1, cell2, cell3;/* ww w. j a v a 2 s . c o m*/ PdfPTable table1, table2, table3; // TABLE 1 table1 = new PdfPTable(new float[] { 5 }); table1.setWidthPercentage(100); cell1 = new PdfPCell(); cell1.setBorder(PdfPCell.NO_BORDER); cell1.setPaddingRight(15); cell1.setPaddingLeft(50); cell1.setPaddingTop(15); paragraph1 = new Paragraph("Programas informticos", font1); paragraph1.setAlignment(paragraph1.ALIGN_LEFT); cell1.addElement(paragraph1); table1.addCell(cell1); document.add(table1); // TABLE 2 table2 = new PdfPTable(new float[] { 9, 1 }); table2.setWidthPercentage(100); // First column cell2 = new PdfPCell(); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setPaddingTop(5); Image long_line_img = Image.getInstance(LONG_LINE_IMAGE); long_line_img.setBorderWidth(10); long_line_img.setBorderColor(BaseColor.WHITE); long_line_img.scaleToFit(475, 50); cell2.addElement(long_line_img); table2.addCell(cell2); // Second column cell2 = new PdfPCell(); cell2.setBorder(PdfPCell.NO_BORDER); table2.addCell(cell2); document.add(table2); // TABLE 3 for (int i = 0; i < softwareList.size(); i++) { table3 = new PdfPTable(new float[] { 6, 4 }); table3.setWidthPercentage(100); table3.setSpacingBefore(5); //First column cell3 = new PdfPCell(); cell3.setBorder(PdfPCell.NO_BORDER); cell3.setPaddingRight(15); cell3.setPaddingLeft(50); if (i == 0) { cell3.setPaddingTop(-1); } paragraph2 = new Paragraph(softwareList.get(i).software + ".", font3); paragraph2.setSpacingBefore(10); cell3.addElement(paragraph2); table3.addCell(cell3); //Second column cell3 = new PdfPCell(); cell3.setBorder(PdfPCell.NO_BORDER); cell3.setPaddingRight(15); cell3.setPaddingLeft(50); if (i == 0) { cell3.setPaddingTop(-1); } paragraph2 = new Paragraph(softwareList.get(i).level + ".", font3); paragraph2.setAlignment(paragraph2.ALIGN_LEFT); cell3.addElement(paragraph2); table3.addCell(cell3); document.add(table3); } }