List of usage examples for com.itextpdf.text Paragraph setAlignment
public void setAlignment(int alignment)
From source file:pdf.CoverLetterUtility.java
License:Apache License
private void addWhyMe(Document document) { TitlePhrase title = new TitlePhrase("Why Me", LifetimeFonts.FONT_BOLD); ValuePhrase text = new ValuePhrase(letter.getWhyMe(), LifetimeFonts.FONT_DEFAULT); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Paragraph.ALIGN_JUSTIFIED); //current.setSpacingBefore(10f); paragraph.add(Chunk.NEWLINE);/*w w w .j a v a2 s. c o m*/ paragraph.add(Chunk.NEWLINE); paragraph.add(title); paragraph.add(Chunk.NEWLINE); paragraph.add(text); paragraph.add(Chunk.NEWLINE); paragraph.add(Chunk.NEWLINE); try { document.add(paragraph); } catch (DocumentException ex) { Logger.getLogger(CoverLetterUtility.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:pdf.CoverLetterUtility.java
License:Apache License
private void addWhyYou(Document document) { TitlePhrase title = new TitlePhrase("Why You", LifetimeFonts.FONT_BOLD); ValuePhrase text = new ValuePhrase(letter.getWhyYou(), LifetimeFonts.FONT_DEFAULT); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Paragraph.ALIGN_JUSTIFIED); //current.setSpacingBefore(10f); paragraph.add(Chunk.NEWLINE);/*from ww w. java 2 s . c om*/ paragraph.add(Chunk.NEWLINE); paragraph.add(title); paragraph.add(Chunk.NEWLINE); paragraph.add(text); paragraph.add(Chunk.NEWLINE); paragraph.add(Chunk.NEWLINE); try { document.add(paragraph); } catch (DocumentException ex) { Logger.getLogger(CoverLetterUtility.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:pdf.CoverLetterUtility.java
License:Apache License
private void addConclusion(Document document) { TitlePhrase title = new TitlePhrase("Conclusion", LifetimeFonts.FONT_BOLD); ValuePhrase text = new ValuePhrase(letter.getConclusion(), LifetimeFonts.FONT_DEFAULT); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Paragraph.ALIGN_JUSTIFIED); //current.setSpacingBefore(10f); paragraph.add(Chunk.NEWLINE);//from w w w . java 2 s . co m paragraph.add(Chunk.NEWLINE); paragraph.add(title); paragraph.add(Chunk.NEWLINE); paragraph.add(text); paragraph.add(Chunk.NEWLINE); paragraph.add(Chunk.NEWLINE); try { document.add(paragraph); } catch (DocumentException ex) { Logger.getLogger(CoverLetterUtility.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:PDF.CrearPDF_Ficha.java
public void generarPDF(ServletOutputStream sops, DatosPDF datos, String url) { try {/*from w w w . j av a 2s . c om*/ Document documento = new Document(); // ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter writer = PdfWriter.getInstance(documento, sops); documento.open(); Image itt_logo; try { itt_logo = Image.getInstance(url); Image Logo_itt = Image.getInstance(itt_logo); Logo_itt.setAbsolutePosition(50f, 698f); Logo_itt.scaleAbsolute(90, 100); documento.add(Logo_itt); } catch (BadElementException | IOException ex) { Logger.getLogger(CrearPDF_Ficha.class.getName()).log(Level.SEVERE, null, ex); } PdfContentByte rectangulo_info = writer.getDirectContentUnder(); drawRectangle(rectangulo_info, 430, 648, 90, 100); Paragraph leyendaFoto = new Paragraph("\nFOTO:\n", FontFactory.getFont("arial", 14, Font.BOLD)); leyendaFoto.setIndentationLeft(200f); Paragraph titulo = new Paragraph("INSTITUTO TECNOLGICO DE TOLUCA", FontFactory.getFont("arial", 14)); titulo.setAlignment(Element.ALIGN_CENTER); Paragraph asunto = new Paragraph("FICHA DE EXAMEN", FontFactory.getFont("arial", 12)); asunto.setAlignment(Element.ALIGN_CENTER); Chunk folio1 = new Chunk("FICHA PARA EL EXAMEN DE ADMISIN: ", FontFactory.getFont("arial", 10)); Chunk folio2 = new Chunk(datos.getFicha(), FontFactory.getFont("arial", 10, Font.BOLD)); Phrase fol = new Phrase(); fol.add(folio1); fol.add(folio2); Paragraph noFicha = new Paragraph(fol); noFicha.setAlignment(Element.ALIGN_LEFT); Chunk nombre1 = new Chunk("NOMBRE DEL SOLICITANTE: ", FontFactory.getFont("arial", 10)); Chunk nombre2 = new Chunk(datos.getNombre(), FontFactory.getFont("arial", 10, Font.BOLD)); Phrase nom = new Phrase(); nom.add(nombre1); nom.add(nombre2); Paragraph nombre = new Paragraph(nom); nombre.setAlignment(Element.ALIGN_LEFT); Chunk in1 = new Chunk("PROCESO PARA EL REGISTRO DE ASPIRANTES EN EL PERIODO: ", FontFactory.getFont("arial", 10)); Chunk in2 = new Chunk(datos.getPeriodoConcursa().toUpperCase(), FontFactory.getFont("arial", 10, Font.BOLD)); Phrase in = new Phrase(); in.add(in1); in.add(in2); Paragraph instrucciones = new Paragraph(in); instrucciones.setAlignment(Element.ALIGN_LEFT); Chunk folCen1 = new Chunk("1.- NMERO DE FOLIO CENEVAL: ", FontFactory.getFont("arial", 10)); Chunk folCen2 = new Chunk(datos.getFolioCENEVAL(), FontFactory.getFont("arial", 10, Font.BOLD)); Phrase folC = new Phrase(); folC.add(folCen1); folC.add(folCen2); Paragraph folioCENEVAL = new Paragraph(folC); folioCENEVAL.setAlignment(Element.ALIGN_LEFT); Chunk fechas1 = new Chunk("2.- LOS EX?MENES DE ADMISIN SE APLICAR?N LOS D?AS: ", FontFactory.getFont("arial", 10)); Chunk fechas2 = new Chunk(datos.getFechaExamenCeneval() + " (" + datos.getLugarExamenCeneval() + ")", FontFactory.getFont("arial", 10, Font.BOLD)); Chunk fechas3 = new Chunk(" Y ", FontFactory.getFont("arial", 10)); Chunk fechas4 = new Chunk(datos.getFechaExamenMate() + " (" + datos.getLugarExamenMate() + ")", FontFactory.getFont("arial", 10, Font.BOLD)); Phrase fechas = new Phrase(); fechas.add(fechas1); fechas.add(fechas2); fechas.add(fechas3); fechas.add(fechas4); Paragraph fechaExamenes = new Paragraph(fechas); fechaExamenes.setAlignment(Element.ALIGN_LEFT); Phrase lugar = new Phrase(); Paragraph lugarYhora = new Paragraph(lugar); lugarYhora.setAlignment(Element.ALIGN_LEFT); Chunk paginaPub1 = new Chunk( "3.- LA PUBLICACIN DE LOS RESULTADOS SER? NICAMENTE EN LA P?GINA WEB: ", FontFactory.getFont("arial", 10)); Anchor url_itt = new Anchor(datos.getPagResultados()); url_itt.setReference(datos.getPagResultados()); Phrase pag = new Phrase(); pag.add(paginaPub1); pag.add(url_itt); Paragraph pagWeb = new Paragraph(pag); Chunk diaPub1 = new Chunk("EL D?A: ", FontFactory.getFont("arial", 10)); Chunk diaPub2 = new Chunk(convertir(datos.getDiaPublicacion() + "-"), FontFactory.getFont("arial", 10, Font.BOLD)); Phrase dia = new Phrase(); dia.add(diaPub1); dia.add(diaPub2); Paragraph diaResultados = new Paragraph(dia); diaResultados.setAlignment(Element.ALIGN_LEFT); Chunk notas = new Chunk("\nNOTAS:\n", FontFactory.getFont("arial", 14, Font.BOLD)); Chunk uno = new Chunk("1.- ", FontFactory.getFont("arial", 10, Font.BOLD)); Chunk guias = new Chunk("Guas de estudio:\n - (CENEVAL) \n", FontFactory.getFont("arial", 10)); Anchor url_guia_cen = new Anchor(" " + datos.getEstudioCeneval()); // url_guia_cen.setReference(datos.getEstudioCeneval()); Chunk ceneval_inter = new Chunk("\n - (CENEVAL INTERACTIVA) \n", FontFactory.getFont("arial", 10)); Anchor url_guia_cen_inter = new Anchor(" " + datos.getEstudioCenevalInt()); url_guia_cen_inter.setReference(datos.getEstudioCenevalInt()); Chunk tem_mate_itt = new Chunk("\n - Temario de Matemticas (TECNOLGICO DE TOLUCA)\n\n", FontFactory.getFont("arial", 10)); Chunk dos = new Chunk("2.- ", FontFactory.getFont("arial", 10, Font.BOLD)); Chunk veri = new Chunk("Verifique que el nmero de folio de Ceneval de esta ficha, coincida con el", FontFactory.getFont("arial", 10)); Chunk fol_ceneval = new Chunk(" FOLIO CENEVAL ", FontFactory.getFont("arial", 10, Font.BOLD)); Chunk capturado = new Chunk("capturado en la informacin proporcionada por el Tecnlogico.\n\n", FontFactory.getFont("arial", 10)); Chunk tres = new Chunk("3.- ", FontFactory.getFont("arial", 10, Font.BOLD)); Chunk dia_exam = new Chunk( "El da del examen deber presentarse con el presente documento, pase de ingreso al examen(Ceneval), una identificacin con fotografa reciente(credencial escolar, IMSS, ISSSTE, ISSEMYM, licencia, pasaporte), lpiz del nmero 2 y goma.\n\n", FontFactory.getFont("arial", 10)); Chunk cuatro = new Chunk("4.- ", FontFactory.getFont("arial", 10, Font.BOLD)); Chunk curso = new Chunk( "Si curs sus estudios de secundaria o bachillerato en el extranjero deber presentar revalidacin de estudios correspondientes al momento de la inscripcin.\n", FontFactory.getFont("arial", 10)); Chunk cinco = new Chunk("\n5.- ", FontFactory.getFont("arial", 10, Font.BOLD)); Chunk examenes = new Chunk( "Los exmenes que se evaluarn son: 1) ADMISIN Y DIAGNSTICO. 2) MATEM?TICAS.", FontFactory.getFont("arial", 10)); Phrase ulti = new Phrase(); ulti.add(notas); ulti.add(uno); ulti.add(guias); ulti.add(url_guia_cen); ulti.add(ceneval_inter); ulti.add(url_guia_cen_inter); ulti.add(tem_mate_itt); ulti.add(dos); ulti.add(veri); ulti.add(fol_ceneval); ulti.add(capturado); ulti.add(tres); ulti.add(dia_exam); ulti.add(cuatro); ulti.add(curso); ulti.add(cinco); ulti.add(examenes); Paragraph ultimo = new Paragraph(ulti); ultimo.setAlignment(Element.ALIGN_LEFT); documento.addTitle("Ficha de Examen"); documento.addSubject("Instituto Tecnolgico de Toluca"); documento.addKeywords("Instituto Tecnolgico de Toluca"); documento.addAuthor("Departamento de Servicios escolares"); documento.addCreator("Departamento de Servicios escolares"); documento.add(titulo); documento.add(asunto); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(noFicha); documento.add(nombre); documento.add(new Paragraph(" ")); documento.add(instrucciones); documento.add(new Paragraph(" ")); documento.add(folioCENEVAL); documento.add(fechaExamenes); documento.add(lugarYhora); documento.add(pagWeb); documento.add(diaResultados); documento.add(new Paragraph(" ")); documento.add(ultimo); documento.close(); } catch (DocumentException ex) { Logger.getLogger(CrearPDF_Ficha.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:PDF.GenerateReportActivities.java
private void addEncabezado(Document document) throws DocumentException { Paragraph preface = new Paragraph(); addEmptyLine(preface, 4);/* www. ja v a2 s .co m*/ preface.setAlignment(Element.ALIGN_CENTER); preface.add(new Paragraph("Instituto Politcnico Nacional", catFont)); preface.add(new Paragraph("Comisin de Operacin y Fomento de Actividades" + " Acadmicas (COFAA)\n Direccin de Especializacin Docente e Investigacin Cientfica y " + "Tecnolgica\nE-SIBE", smallBold)); addEmptyLine(preface, 2); document.add(preface); }
From source file:PDF.GenerateReportActivities.java
private void addResumenProf(Document document) throws DocumentException, Exception { Paragraph preface = new Paragraph(); preface.add(new Paragraph("Datos Generales del Profesor", smallBold)); preface.setAlignment(Element.ALIGN_CENTER); addEmptyLine(preface, 2);/*from w w w . ja v a 2 s . c o m*/ document.add(preface); document.add(TablaDatos()); }
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//from w w w . j a v a2s.c om * @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.PdfUtility.java
private void addTitle(Document document) { try {//w w w . ja v a 2 s . com // Create a phrase Phrase namePhrase = new TitlePhrase(getFullname(), LifetimeFonts.FONT_HEADER); Phrase emailPhrase = new TitlePhrase(user.getEmail(), LifetimeFonts.FONT_DEFAULT); // Wrap it into a centered paragraph Paragraph title = new Paragraph(); title.setAlignment(Element.ALIGN_CENTER); title.add(namePhrase); title.add(NEWLINE); title.add(emailPhrase); if (user.getBirthdate() != null) { title.add(NEWLINE); title.add(new TitlePhrase(formatDate(user.getBirthdate()), LifetimeFonts.FONT_DEFAULT)); } if (user.getBirthplace() != null) { title.add(NEWLINE); title.add(new TitlePhrase(user.getBirthplace(), LifetimeFonts.FONT_DEFAULT)); } // return the paragraph to be added into de document document.add(title); } catch (DocumentException ex) { Logger.getLogger(PdfUtility.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:pdf.PdfUtility.java
private Paragraph addTableEntry(Achievement a) { PdfPTable mainTable = new PdfPTable(new float[] { 1f, 5f }); mainTable.setWidthPercentage(100f);//from w w w . j a va 2 s . c om mainTable.setSpacingBefore(0f); mainTable.setSpacingAfter(0f); PdfPCell datesCell = getDateCell(a); PdfPCell summaryCell = getSummaryCell(a); mainTable.addCell(datesCell); mainTable.addCell(summaryCell); Paragraph current = new Paragraph(); current.setAlignment(Paragraph.ALIGN_LEFT); //current.setSpacingBefore(10f); current.add(mainTable); return current; }
From source file:PDF.Reportes.java
public void reportesPDF(HttpServletResponse response, int tr, ServletContext d, String usuario, String contra, String horario, int opc) { String reporteT = ""; try {//from ww w .j av a 2 s .c o m Document reporte = new Document(); Calendar cal = Calendar.getInstance(); Paragraph intro = new Paragraph(); intro.setAlignment(Element.ALIGN_CENTER); String linea = "/Imagenes/rallita.png"; String absolute_url_linea = d.getRealPath(linea); Image linea_div = Image.getInstance(absolute_url_linea); Paragraph vacio = new Paragraph(" ", FontFactory.getFont("arial", 10)); vacio.setAlignment(Element.ALIGN_CENTER); if (tr == 0) { PdfWriter writer = PdfWriter.getInstance(reporte, response.getOutputStream()); Rectangle rect = new Rectangle(30, 30, 550, 800); writer.setBoxSize("art", rect); HeaderFooterPageEvent event = new HeaderFooterPageEvent("header_pdf.png"); writer.setPageEvent(event); reporte.open(); reporte.add(vacio); reporte.add(vacio); ArrayList<JFreeChart> graf = grafica(usuario, contra); if (graf == null) { intro = new Paragraph( "Lo sentimos, por el momento an no existe informacin para este reporte.", FontFactory.getFont("arial", 18)); reporte.add(intro); } else { for (int i = 0; i < graf.size(); i++) { BufferedImage bufferedImage = graf.get(i).createBufferedImage(500, 300); Image chart = Image.getInstance(writer, bufferedImage, 1.0f); reporte.add(vacio); reporte.add(chart); } } reporteT = "Estadsticas de registros."; } if (tr == 1) { PdfWriter writer = PdfWriter.getInstance(reporte, response.getOutputStream()); Rectangle rect = new Rectangle(30, 30, 550, 800); writer.setBoxSize("art", rect); HeaderFooterPageEvent event = new HeaderFooterPageEvent("header_pdf.png"); writer.setPageEvent(event); reporte.open(); reporte.add(linea_div); Paragraph creador = new Paragraph("Instituto Tecnolgico de Toluca\n" + "\n" + "Centro de Cmputo\n" + "\n" + "Coordinacin de Desarrollo de Sistemas", FontFactory.getFont("arial", 10)); reporte.add(creador); reporte.add(linea_div); intro = new Paragraph("Sin alta en CENEVAL " + cal.get(Calendar.YEAR), FontFactory.getFont("arial", 18)); intro.setAlignment(Element.ALIGN_CENTER); reporte.add(intro); reporte.add(vacio); reporte.add(vacio); reporte.add(noaltaCen(usuario, contra)); reporteT = "Sin alta en CENEVAL."; } if (tr == 2) { PdfWriter writer = PdfWriter.getInstance(reporte, response.getOutputStream()); Rectangle rect = new Rectangle(30, 30, 550, 800); writer.setBoxSize("art", rect); HeaderFooterPageEvent event = new HeaderFooterPageEvent("header_pdf.png"); writer.setPageEvent(event); reporte.open(); reporte.add(linea_div); Paragraph creador = new Paragraph("Instituto Tecnolgico de Toluca\n" + "\n" + "Centro de Cmputo\n" + "\n" + "Coordinacin de Desarrollo de Sistemas", FontFactory.getFont("arial", 10)); reporte.add(creador); reporte.add(linea_div); intro = new Paragraph("Estatus Prefichas " + cal.get(Calendar.YEAR), FontFactory.getFont("arial", 18)); intro.setAlignment(Element.ALIGN_CENTER); reporte.add(intro); reporte.add(vacio); reporte.add(vacio); reporte.add(statusfichas(usuario, contra)); reporteT = "Estatus prefichas"; } if (tr == 3) { PdfWriter writer = PdfWriter.getInstance(reporte, response.getOutputStream()); Rectangle rect = new Rectangle(30, 30, 550, 800); writer.setBoxSize("art", rect); HeaderFooterPageEvent event = new HeaderFooterPageEvent("header_pdf.png"); writer.setPageEvent(event); reporte.open(); reporte.add(linea_div); Paragraph creador = new Paragraph("Instituto Tecnolgico de Toluca\n" + "\n" + "Centro de Cmputo\n" + "\n" + "Coordinacin de Desarrollo de Sistemas", FontFactory.getFont("arial", 10)); reporte.add(creador); reporte.add(linea_div); intro = new Paragraph("Pre proceso concluido " + cal.get(Calendar.YEAR), FontFactory.getFont("arial", 18)); intro.setAlignment(Element.ALIGN_CENTER); reporte.add(intro); reporte.add(vacio); reporte.add(vacio); reporte.add(procesoCon(usuario, contra)); reporteT = "Pre proceso concluido"; } if (tr == 4) { PdfWriter writer = PdfWriter.getInstance(reporte, response.getOutputStream()); ArrayList<PdfPTable> tables = firmasAspAula(usuario, contra, horario, opc); Rectangle rect = new Rectangle(30, 30, 550, 800); writer.setBoxSize("art", rect); HeaderFooterPageEvent2 event = new HeaderFooterPageEvent2("ficha-pdf.png"); writer.setPageEvent(event); reporte.open(); if (tables.size() != 1) { PdfPTable tableH = tables.get(tables.size() - 1); tableH.writeSelectedRows(0, -1, 10, 720, writer.getDirectContent()); } else { reporte.add(tables.get(0)); } reporte.add(vacio); reporte.add(vacio); reporte.add(vacio); for (int i = 0; i < tables.size(); i++) { if (i + 1 != tables.size()) { reporte.add(tables.get(i)); if (i + 2 != tables.size()) { reporte.newPage(); } } } reporteT = "Firmas Aspirantes_" + horario; } if (tr == 5) { PdfWriter writer = PdfWriter.getInstance(reporte, response.getOutputStream()); ArrayList<PdfPTable> tables = tablaAspAula(usuario, contra, horario, opc); Rectangle rect = new Rectangle(30, 30, 550, 800); writer.setBoxSize("art", rect); HeaderFooterPageEvent2 event = new HeaderFooterPageEvent2("ficha-pdf.png"); writer.setPageEvent(event); reporte.open(); if (tables.size() != 1) { PdfPTable tableH = tables.get(tables.size() - 1); tableH.writeSelectedRows(0, -1, 10, 720, writer.getDirectContent()); } else { reporte.add(tables.get(0)); } reporte.add(vacio); reporte.add(vacio); reporte.add(vacio); for (int i = 0; i < tables.size(); i++) { if (i + 1 != tables.size()) { reporte.add(tables.get(i)); if (i + 2 != tables.size()) { reporte.newPage(); } } } reporteT = "Aspirantes por aula horario_" + horario; } reporte.addTitle("Reportes_" + reporteT); reporte.addSubject("Instituto Tecnolgico de Toluca"); reporte.addKeywords("Instituto Tecnolgico de Toluca"); reporte.addAuthor("Coordinacion de desarrollo de sistemas"); reporte.addCreator("Centro de Cmputo ITT"); //Asignamos el manejador de eventos al escritor. reporte.close(); } catch (DocumentException | IOException ex) { Logger.getLogger(Reportes.class.getName()).log(Level.SEVERE, null, ex); } }