List of usage examples for com.itextpdf.text Element ALIGN_MIDDLE
int ALIGN_MIDDLE
To view the source code for com.itextpdf.text Element ALIGN_MIDDLE.
Click Source Link
From source file:pdf.PDFDesign.java
private PdfPCell createEuroCell(Item item) throws DocumentException, IOException { Font descFont = new Font(droidsans, 12, Font.NORMAL, color); Font unitPriceFont = new Font(droidsans, 10, Font.NORMAL, color); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100f);//from w w w . j av a 2s.c o m PdfPCell cell; Paragraph p; cell = new PdfPCell(); p = new Paragraph(); p.setFont(descFont); p.add(item.getTitle()); cell.setFixedHeight(28f); cell.setPhrase(p); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); p = new Paragraph(); p.setFont(descFont); p.add(item.getAmount() + item.getUnit()); cell.setFixedHeight(16f); cell.setPhrase(p); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(0); table.addCell(cell); table.addCell(createEuroInnerPrice(item)); cell = new PdfPCell(); p = new Paragraph(); p.setFont(unitPriceFont); p.add("Cena za 1" + item.getXUnit() + ": " + item.getUnitPrice() + item.getCurrency() + "/" + item.getSecondUnitPrice() + item.getSecondCurrency()); cell.setPhrase(p); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(0); cell.setLeading(2f, 0f); table.addCell(cell); PdfPCell finalCell = new PdfPCell(table); finalCell.setFixedHeight(117.4f); finalCell.setBorderColor(BaseColor.GRAY); return finalCell; }
From source file:pdf.PDFDesign.java
private PdfPCell createEuroInnerInnerPrice(String price, String curr, boolean isFirst) throws DocumentException { Font bigPriceFont = new Font(droidsans, 40, Font.BOLD, color); Font smallPriceFont = new Font(droidsans, 18, Font.NORMAL, color); Font unitFont = new Font(droidsans, 12, Font.NORMAL, color); PdfPTable table = new PdfPTable(2); table.setWidths(new float[] { 3f, 1f }); PdfPCell cell;/*ww w .j a va2 s . c om*/ Paragraph para; para = new Paragraph(""); para.setFont(bigPriceFont); if (price.length() >= 4) { para.add(price.substring(0, price.length() - 3)); } cell = new PdfPCell(para); cell.setRowspan(2); cell.setFixedHeight(57f); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); para = new Paragraph(""); para.setFont(smallPriceFont); if (price.length() >= 4) { para.add(price.substring(price.length() - 2, price.length())); } cell = new PdfPCell(para); cell.setRowspan(1); cell.setFixedHeight(35f); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); cell.setBorder(0); table.addCell(cell); para = new Paragraph(); para.setFont(unitFont); para.add(curr); cell = new PdfPCell(para); cell.setRowspan(1); cell.setFixedHeight(22f); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setBorder(0); table.addCell(cell); PdfPCell finalCell = new PdfPCell(table); finalCell.setBorder(0); /*if (isFirst) { finalCell.setBorder(Rectangle.RIGHT); }*/ return finalCell; }
From source file:pdf.PDFDesign.java
private PdfPCell createEuro_6_Cell(Item item) throws DocumentException { PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100f);/*from w w w. j av a2 s .c o m*/ PdfPCell cell; Paragraph p; cell = new PdfPCell(); p = new Paragraph(); p.setFont(new Font(droidsans, 13, Font.NORMAL, color)); String t = item.getTitle(); String[] split = t.split("//"); for (String split1 : split) { p.add(split1 + "\n"); } cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setPhrase(p); cell.setColspan(2); cell.setFixedHeight(30f); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); p = new Paragraph(); p.setFont(new Font(droidsans, 11, Font.NORMAL, color)); p.add(item.getAmount() + "" + item.getUnit()); cell.setPhrase(p); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); table.addCell(createEuro_6_InnerPrice(item)); cell = new PdfPCell(); p = new Paragraph(); p.setFont(new Font(droidsans, 11, Font.NORMAL, color)); p.add("Cena za 1" + item.getXUnit() + ": " + item.getUnitPrice() + item.getCurrency() + "/" + item.getSecondUnitPrice() + item.getSecondCurrency()); cell.setPhrase(p); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(0); table.addCell(cell); PdfPCell finalCell = new PdfPCell(table); finalCell.setFixedHeight(cellHeight);//175f finalCell.setBorderColor(BaseColor.GRAY); return finalCell; }
From source file:pdf.PDFDesign.java
private PdfPCell createEuro_6_InnerInnerPrice(String price, String curr, boolean isFirst) throws DocumentException { PdfPTable table = new PdfPTable(2); table.setWidths(new float[] { 3f, 1.2f }); PdfPCell cell;//from w ww. j a v a2 s .c o m Paragraph para; para = new Paragraph(""); para.setFont(new Font(droidsans, 60, Font.BOLD, color)); if (price.length() >= 4) { para.add(price.substring(0, price.length() - 3)); } cell = new PdfPCell(para); cell.setRowspan(2); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setLeading(50f, 0f); cell.setBorder(0); table.addCell(cell); para = new Paragraph(""); para.setFont(new Font(droidsans, 28, Font.NORMAL, color)); if (price.length() >= 4) { para.add(price.substring(price.length() - 2, price.length())); } cell = new PdfPCell(para); cell.setRowspan(1); cell.setFixedHeight(32f); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); cell.setBorder(0); table.addCell(cell); para = new Paragraph(); para.setFont(new Font(droidsans, 16, Font.NORMAL, color)); para.add(curr); cell = new PdfPCell(para); cell.setRowspan(1); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setBorder(0); table.addCell(cell); PdfPCell finalCell = new PdfPCell(table); finalCell.setBorder(0); /*if (isFirst) { finalCell.setBorder(Rectangle.RIGHT); }*/ return finalCell; }
From source file:PDF.PDFTrackGenerator.java
License:Open Source License
/** * Metda generateTrackPDFA4 sli na samotn vygenerovanie PDF dokumentu trasy na formt A4. * @param lineWeight - hrbka ?iary trasy na mape * @param color - farba ?iary trasy na mape * @param width - rka mapy/* www.j a v a 2s. c o m*/ * @param height - vka mapy * @param scale - klovacia kontanta mapy (n x rozlenie mapy) * @param startDate - dtum a ?as prvho bodu trasy * @param endDate - dtum a ?as poslednho bodu trasy * @param activity - aktivita trasy * @param user - pouvate (majite) trasy */ public void generateTrackPDFA4(int lineWeight, String color, int width, int height, int scale, String startDate, String endDate, String activity, String user) { try { Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream(path + fileName + ".pdf")); doc.open(); Font nadpisFont = new Font(Font.FontFamily.HELVETICA, 25, Font.BOLD); Font detailyFont = new Font(Font.FontFamily.HELVETICA, 9, Font.NORMAL); Paragraph nadpisPar = new Paragraph(); nadpisPar.setAlignment(Element.ALIGN_CENTER); Phrase nadpis = new Phrase(fileName, nadpisFont); nadpisPar.add(nadpis); nadpisPar.add(""); doc.add(nadpisPar); doc.add(Chunk.NEWLINE); PdfPTable tabulka = new PdfPTable(2); tabulka.setWidthPercentage(100); float[] columnWidth = { 6f, 4f }; tabulka.setWidths(columnWidth); StaticMapResolver res = new StaticMapResolver(loader); String mapUrl = res.getStaticMapTrackURLWithMultimedia(lineWeight, color, width, height, scale); Image img = Image.getInstance(new URL(mapUrl)); //img.scalePercent(50); PdfPCell riadokSObr = new PdfPCell(img, true); riadokSObr.setBorder(Rectangle.NO_BORDER); riadokSObr.setPaddingBottom(10f); PdfPCell riadokSText = new PdfPCell(new Phrase("Description: " + loader.getTrackDescription() + "\n\n\nTrack activity: " + activity.substring(4) + "\n\n\nStart place: " + loader.getStartAddress() + "\n\n\nEnd Place: " + loader.getEndAddress() + "\n\n\nTrack length: " + loader.getLength() + " km\n\n\nMin elevation: " + loader.getMinElevation() + " m\n\n\nMax elevation: " + loader.getMaxElevation() + " m\n\n\nHeight difference: " + loader.getHeightDiff() + " m\n\n\nStart: " + startDate + "\n\n\nEnd: " + endDate + "\n\n\nDuration: " + loader.getDuration(), detailyFont)); riadokSText.setBorder(Rectangle.NO_BORDER); riadokSText.setPaddingLeft(20f); riadokSText.setPaddingTop(5f); riadokSText.setPaddingBottom(10f); tabulka.addCell(riadokSObr); tabulka.addCell(riadokSText); doc.add(tabulka); //doc.add(new Phrase("\n", detailyFont)); PdfPTable obrTabulka = new PdfPTable(3); obrTabulka.setWidthPercentage(100); ArrayList<String> goodFiles = new ArrayList<String>(); for (int i = 0; i < loader.getMultimediaFiles().size(); i++) { if (!loader.getMultimediaFiles().get(i).getPath().startsWith("YTB")) { String extension = loader.getMultimediaFiles().get(i).getPath().substring( loader.getMultimediaFiles().get(i).getPath().lastIndexOf("."), loader.getMultimediaFiles().get(i).getPath().length()); String newPath = loader.getMultimediaFiles().get(i).getPath().substring(0, loader.getMultimediaFiles().get(i).getPath().lastIndexOf(".")) + "_THUMB" + extension; goodFiles.add(newPath); } } if (!goodFiles.isEmpty()) { int freeCount = 9; if (goodFiles.size() <= 9) { for (int i = 0; i < goodFiles.size(); i++) { Image tempImg = Image.getInstance(goodFiles.get(i)); tempImg.scalePercent(10f); PdfPCell tempCell = new PdfPCell(tempImg, true); tempCell.setPadding(3f); //tempCell.setPaddingTop(5f); tempCell.setVerticalAlignment(Element.ALIGN_MIDDLE); tempCell.setHorizontalAlignment(Element.ALIGN_CENTER); tempCell.setFixedHeight(130f); tempCell.setBackgroundColor(BaseColor.BLACK); tempCell.setBorderColor(BaseColor.WHITE); tempCell.setBorderWidth(4f); //tempCell.setBorder(Rectangle.NO_BORDER); obrTabulka.addCell(tempCell); } for (int i = 0; i < 9 - goodFiles.size(); i++) { PdfPCell tempCell = new PdfPCell(); tempCell.setBorder(Rectangle.NO_BORDER); obrTabulka.addCell(tempCell); } } else if (goodFiles.size() <= 18) { for (int i = 0; i < 9; i++) { Image tempImg = Image.getInstance(goodFiles.get(i)); tempImg.scalePercent(10f); PdfPCell tempCell = new PdfPCell(tempImg, true); tempCell.setPadding(3f); //tempCell.setPaddingTop(5f); tempCell.setVerticalAlignment(Element.ALIGN_MIDDLE); tempCell.setHorizontalAlignment(Element.ALIGN_CENTER); tempCell.setFixedHeight(130f); tempCell.setBackgroundColor(BaseColor.BLACK); tempCell.setBorderColor(BaseColor.WHITE); tempCell.setBorderWidth(4f); //tempCell.setBorder(Rectangle.NO_BORDER); obrTabulka.addCell(tempCell); } } else { for (int i = 0; i < (goodFiles.size() % 9); i++) { goodFiles.remove(goodFiles.size() - 1 - i); } int counting = (goodFiles.size() / 9); for (int i = 0; i < goodFiles.size(); i = i + counting) { Image tempImg = Image.getInstance(goodFiles.get(i)); tempImg.scalePercent(10f); PdfPCell tempCell = new PdfPCell(tempImg, true); tempCell.setPadding(3f); //tempCell.setPaddingTop(5f); tempCell.setVerticalAlignment(Element.ALIGN_MIDDLE); tempCell.setHorizontalAlignment(Element.ALIGN_CENTER); tempCell.setFixedHeight(130f); tempCell.setBackgroundColor(BaseColor.BLACK); tempCell.setBorderColor(BaseColor.WHITE); tempCell.setBorderWidth(4f); //tempCell.setBorder(Rectangle.NO_BORDER); obrTabulka.addCell(tempCell); freeCount--; } for (int i = 0; i < freeCount; i++) { PdfPCell tempCell = new PdfPCell(); tempCell.setBorder(Rectangle.NO_BORDER); obrTabulka.addCell(tempCell); } } } doc.add(obrTabulka); Font lastFont = new Font(Font.FontFamily.HELVETICA, 7, Font.ITALIC); Phrase lastText = new Phrase("This PDF document was generated by gTrax app for user " + user, lastFont); doc.add(lastText); doc.close(); } catch (Exception ex) { FileLogger.getInstance() .createNewLog("ERROR: Cannot CREATE PDF for track " + fileName + " for user " + user + " !!!"); System.out.println("pruser"); } }
From source file:PDF.Reporte_Final.java
private PdfPTable tablaEvaluador_profe() throws Exception { PdfPTable tabla_evaluador = new PdfPTable(5); tabla_evaluador.setWidths(new int[] { 2, 2, 3, 2, 3 }); int anio = 0, anio_fin = 0; PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Tabla de evaluadores con los " + "profesores asignados", encabezadost)); PdfPCell evaluador = new PdfPCell(new Phrase("Nmero de empleado de evaluador")); PdfPCell profesor = new PdfPCell(new Phrase("Nmero de empleado de profesor")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Puntaje total asignado")); PdfPCell Puntos = new PdfPCell(new Phrase("Fecha de evaluacin")); PdfPCell Observaciones = new PdfPCell(new Phrase("Periodo Correspondiente")); //PdfPCell celda=new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5);//from ww w. j a v a 2s.c om Titulo_tabla.setExtraParagraphSpace(15f); tabla_evaluador.addCell(Titulo_tabla); evaluador.setHorizontalAlignment(Element.ALIGN_CENTER); evaluador.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(evaluador); profesor.setHorizontalAlignment(Element.ALIGN_CENTER); profesor.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(profesor); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ ResultSet rb = lb.executeQuery("SELECT * FROM evaluador_evalua_profesor"); while (rb.next()) { tabla_evaluador.addCell(rb.getString("id_usuario_ev")); tabla_evaluador.addCell(rb.getString("id_usuario_prof"));//Add the type of every type pub tabla_evaluador.addCell(rb.getString("puntaje_final")); tabla_evaluador.addCell(rb.getString("fecha_ev")); if (rb.getInt("periodo") == 1) { anio = 2017; anio_fin = 2018; } else if (rb.getInt("periodo") == 2) { anio = 2018; anio_fin = 2019; } else if (rb.getInt("periodo") == 3) { anio = 2019; anio_fin = 2020; } else if (rb.getInt("periodo") == 4) { anio = 2020; anio_fin = 2021; } tabla_evaluador.addCell(anio + " - " + anio_fin); } return tabla_evaluador; }
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_num_prof() throws Exception { PdfPTable tabla_num = new PdfPTable(2); tabla_num.setWidths(new int[] { 2, 2 }); String periodo = ""; PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Nmero total de evaluadores y profesores " + "participantes", encabezadost)); PdfPCell evaluador = new PdfPCell(new Phrase("Nmero de evaluadores")); PdfPCell profesor = new PdfPCell(new Phrase("Nmero de profesores")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5);// www .j a v a 2s.co m Titulo_tabla.setExtraParagraphSpace(15f); tabla_num.addCell(Titulo_tabla); evaluador.setHorizontalAlignment(Element.ALIGN_CENTER); evaluador.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(evaluador); profesor.setHorizontalAlignment(Element.ALIGN_CENTER); profesor.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(profesor); /*Aqui van las consultas de las Actividades del profesor*/ int i = 0; ResultSet re = lb.executeQuery("SELECT * FROM evaluador"), rp; String numberAsString;// = Integer.toString(number); while (re.next()) { i++; periodo = re.getString("periodo_actual"); } //System.out.println(i); numberAsString = Integer.toString(i); tabla_num.addCell(numberAsString); i = 0; rp = lb.executeQuery("SELECT * FROM profesor WHERE periodo = " + periodo); while (rp.next()) { i++; } //System.out.println(numberAsString); numberAsString = Integer.toString(i); tabla_num.addCell(numberAsString); return tabla_num; }
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_evaluador() throws Exception { PdfPTable tabla_num = new PdfPTable(2); tabla_num.setWidths(new int[] { 2, 2 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Actividades aceptadas por evaluador", encabezadost)); PdfPCell evaluador = new PdfPCell(new Phrase("Nmero de empleado del evaluador")); PdfPCell actividades = new PdfPCell(new Phrase("Nmero de actividades aceptadas")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5);/*from ww w . j ava2 s . c om*/ Titulo_tabla.setExtraParagraphSpace(15f); tabla_num.addCell(Titulo_tabla); evaluador.setHorizontalAlignment(Element.ALIGN_CENTER); evaluador.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(evaluador); actividades.setHorizontalAlignment(Element.ALIGN_CENTER); actividades.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(actividades); /*Aqui van las consultas de las Actividades del profesor*/ int[] evaluador_num = new int[100]; int[][] profesor_num = new int[300][300]; String numberAsString, numberAsString2; int eva = 0, prof = 0, num_prof = 0, i = 0, n = 0, aux, suma_act = 0; ResultSet rs, ra; rs = lb.executeQuery("SELECT * FROM evaluador_evalua_profesor"); while (rs.next()) { if (i == 0) aux = 1; else aux = i; if (evaluador_num[aux - 1] != rs.getInt("id_usuario_ev")) { evaluador_num[i] = rs.getInt("id_usuario_ev"); i++; } else { System.out.println("Ya existe"); } } //We get evaluators for (int e = 0; e < i; e++) { aux = getAccepted_Activities(evaluador_num[e]); numberAsString = Integer.toString(evaluador_num[e]); tabla_num.addCell(numberAsString); numberAsString2 = Integer.toString(aux); tabla_num.addCell(numberAsString2); } return tabla_num; }
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_profesores_nivel() throws Exception { PdfPTable tabla_num = new PdfPTable(3); int anio = 0, anio_fin = 0; tabla_num.setWidths(new int[] { 2, 2, 2 }); PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Lista de profesores participantes para este periodo", encabezadost)); PdfPCell profesor = new PdfPCell(new Phrase("Nmero de empleado")); PdfPCell nivel = new PdfPCell(new Phrase("Nivel de beca (Preliminar)")); PdfPCell periodo = new PdfPCell(new Phrase("Periodo")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5);//from w w w .ja v a 2s . c o m Titulo_tabla.setExtraParagraphSpace(15f); tabla_num.addCell(Titulo_tabla); profesor.setHorizontalAlignment(Element.ALIGN_CENTER); profesor.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(profesor); nivel.setHorizontalAlignment(Element.ALIGN_CENTER); nivel.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(nivel); periodo.setHorizontalAlignment(Element.ALIGN_CENTER); periodo.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(periodo); /*Aqui van las consultas de las Actividades del profesor*/ ResultSet rs, rperiodo; int periodo_actual = 0; rperiodo = lb.executeQuery("SELECT * FROM evaluador"); while (rperiodo.next()) { periodo_actual = rperiodo.getInt("periodo_actual"); } rs = lb.executeQuery("SELECT * FROM profesor WHERE periodo = " + periodo_actual); while (rs.next()) { tabla_num.addCell(rs.getString("id_usuario")); tabla_num.addCell(rs.getString("nivel")); if (rs.getInt("periodo") == 1) { anio = 2017; anio_fin = 2018; } else if (rs.getInt("periodo") == 2) { anio = 2018; anio_fin = 2019; } else if (rs.getInt("periodo") == 3) { anio = 2019; anio_fin = 2020; } else if (rs.getInt("periodo") == 4) { anio = 2020; anio_fin = 2021; } tabla_num.addCell(anio + " - " + anio_fin); } return tabla_num; }
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_alumnos() throws Exception { PdfPTable tabla_num = new PdfPTable(4); int a = 0, b = 0, c = 0, d = 0, e = 0; String numberAsString;/*from w w w .j a v a 2 s . c om*/ tabla_num.setWidths(new int[] { 2, 2, 2, 2 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Alumnos BEIFI y de SS", encabezadost)); PdfPCell BEIFI_Acep = new PdfPCell(new Phrase("BEIFI aceptados")); PdfPCell BEIFI_No = new PdfPCell(new Phrase("BEIFI no aceptados")); PdfPCell SS_Acep = new PdfPCell(new Phrase("SS aceptados")); PdfPCell SS_No = new PdfPCell(new Phrase("SS no aceptados")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); tabla_num.addCell(Titulo_tabla); BEIFI_Acep.setHorizontalAlignment(Element.ALIGN_CENTER); BEIFI_Acep.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(BEIFI_Acep); BEIFI_No.setHorizontalAlignment(Element.ALIGN_CENTER); BEIFI_No.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(BEIFI_No); SS_Acep.setHorizontalAlignment(Element.ALIGN_CENTER); SS_Acep.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(SS_Acep); SS_No.setHorizontalAlignment(Element.ALIGN_CENTER); SS_No.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(SS_No); //we get the four numbers for students a = getNum2_1(2); numberAsString = Integer.toString(a); tabla_num.addCell(numberAsString); b = getNum2_1(3); numberAsString = Integer.toString(b); tabla_num.addCell(numberAsString); c = getNum2_1(4); numberAsString = Integer.toString(c); tabla_num.addCell(numberAsString); d = getNum2_1(5); numberAsString = Integer.toString(d); tabla_num.addCell(numberAsString); return tabla_num; }