List of usage examples for com.itextpdf.layout.element Cell Cell
public Cell()
From source file:cl.a2r.wsmicampov2.pdf.CellHelper.java
public static Cell getCellObservaciones(String text, TextAlignment alignment) { Cell cell = new Cell().add(new Paragraph(text)); cell.setPadding(0);/*from w w w. ja va 2s . c om*/ cell.setTextAlignment(alignment); cell.setHeight(130); return cell; }
From source file:cl.a2r.wsmicampov2.pdf.CellHelper.java
public static Cell getCellFirma(String text, TextAlignment alignment) { Cell cell = new Cell().add(new Paragraph(text)); cell.setPadding(0);//from ww w . j ava 2 s . c om cell.setTextAlignment(alignment); cell.setHeight(100); cell.setBorder(Border.NO_BORDER); cell.setBold(); ILineDash solid = new Solid(); cell.setNextRenderer(new CustomBorder3Renderer(cell, new ILineDash[] { solid, null, null, null })); return cell; }
From source file:cl.a2r.wsmicampov2.pdf.CellHelper.java
public static Cell getCell(String text, TextAlignment alignment) { Cell cell = new Cell().add(new Paragraph(text)); cell.setPadding(0);// ww w . ja va 2 s . c o m cell.setTextAlignment(alignment); cell.setBorder(Border.NO_BORDER); return cell; }
From source file:cl.a2r.wsmicampov2.pdf.CellHelper.java
public static Cell getCell(String text1, String text2, TextAlignment alignment) { try {/* w ww. ja va 2 s.com*/ PdfFont bold = PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD); Text tx1 = new Text(text1).setFont(bold); Text tx2 = new Text(text2); Paragraph p = new Paragraph().add(tx1).add(tx2); Cell cell = new Cell().add(p); cell.setPadding(0); cell.setTextAlignment(alignment); cell.setBorder(Border.NO_BORDER); return cell; } catch (Exception ex) { } return null; }
From source file:cl.a2r.wsmicampov2.pdf.CellHelper.java
public static Cell getCellDiios(String text, TextAlignment alignment) { Cell cell = new Cell().add(new Paragraph(text)); cell.setPadding(0);//from w ww . j a v a2 s.co m cell.setTextAlignment(alignment); cell.setHeight(20); cell.setBorder(Border.NO_BORDER); return cell; }
From source file:com.asptt.plongee.resa.util.UtilsFSpdf.java
private Table createEntete(FicheSecurite fs, int numeroPage, int nbPage) throws java.io.IOException { float[] columnWidths = { 20, 27, 23, 23, 6 }; // table : premiere table pour les parametres de la plonge Table table = new Table(columnWidths); table.setMargins(0, 0, 0, 0);//from w ww.j a v a 2 s . co m table.setWidthPercent(100); // entete style pour les entetes Style entete = new Style(); PdfFont fontEntete = PdfFontFactory.createFont(FontConstants.TIMES_ROMAN); entete.setFont(fontEntete).setFontSize(12); entete.setFontColor(Color.BLACK); // style pour les libells Style libelle = new Style(); PdfFont fontLibelle = PdfFontFactory.createFont(FontConstants.TIMES_ROMAN); libelle.setFont(fontLibelle).setFontSize(12); libelle.setFontColor(Color.RED); Paragraph entete1 = new Paragraph(); entete1.add(new Text("DATE\n").addStyle(entete)); entete1.add(new Text("DIRECTEUR DE PLONGEE\n").addStyle(entete)); entete1.add(new Text("PILOTE DU BATEAU\n").addStyle(entete)); entete1.add(new Text("LIEU DE PLONGEE\n").addStyle(entete)); entete1.add(new Text("METEO\n").addStyle(entete)); Paragraph libelle1 = new Paragraph(); libelle1.add(new Text(": " + ResaUtil.getDateString(fs.getDatePlongee()) + "\n").addStyle(libelle)); libelle1.add(new Text(": " + fs.getNomDP() + "\n").addStyle(libelle)); libelle1.add(new Text(": " + fs.getNomPilote() + "\n").addStyle(libelle)); libelle1.add(new Text(": " + fs.getSite() + "\n").addStyle(libelle)); libelle1.add(new Text(": " + fs.getMeteo() + "\n").addStyle(libelle)); Cell cellEntete1 = new Cell(); cellEntete1.add(entete1); cellEntete1.setBorderRight(Border.NO_BORDER); cellEntete1.setHorizontalAlignment(HorizontalAlignment.LEFT); table.addCell(cellEntete1); Cell cellLibelle1 = new Cell(); cellLibelle1.add(libelle1); cellLibelle1.setBorderLeft(Border.NO_BORDER); cellLibelle1.setTextAlignment(TextAlignment.LEFT); table.addCell(cellLibelle1); Paragraph titre = new Paragraph(); titre.add(new Text("ASPTT MARSEILLE\n").addStyle(entete)); titre.add(new Text("PLONGEE\n").addStyle(entete)); titre.add(new Text("---\n").addStyle(entete)); titre.add(new Text("Fiche de Scurit\n").addStyle(entete)); Cell cellTitre = new Cell(); cellTitre.add(titre); cellTitre.setTextAlignment(TextAlignment.CENTER); cellTitre.setVerticalAlignment(VerticalAlignment.MIDDLE); table.addCell(cellTitre); Paragraph entete2 = new Paragraph(); entete2.add(new Text("PLONGEE NUMERO\n").addStyle(entete)); entete2.add(new Text("NOMBRE DE PLONGEURS\n").addStyle(entete)); entete2.add(new Text("HEURE DE DEPART\n").addStyle(entete)); entete2.add(new Text("HEURES BATEAU\n").addStyle(entete)); entete2.add(new Text("Page \n").addStyle(entete)); Paragraph libelle2 = new Paragraph(); libelle2.add(new Text(": " + fs.getNumeroPlongee() + "\n").addStyle(libelle)); libelle2.add(new Text(": " + fs.getNbPlongeurs() + "\n").addStyle(libelle)); libelle2.add(new Text(": " + fs.getHhDepart() + ":" + fs.getMnDepart() + "\n").addStyle(libelle)); libelle2.add(new Text(": " + fs.getNbHeuresBateau() + "\n").addStyle(libelle)); libelle2.add(new Text(": " + numeroPage + " / " + nbPage + "\n").addStyle(libelle)); Cell cellEntete2 = new Cell(); cellEntete2.add(entete2); cellEntete2.setBorderRight(Border.NO_BORDER); cellEntete2.setHorizontalAlignment(HorizontalAlignment.RIGHT); table.addCell(cellEntete2); Cell cellLibelle2 = new Cell(); cellLibelle2.add(libelle2); cellLibelle2.setBorderLeft(Border.NO_BORDER); cellLibelle2.setTextAlignment(TextAlignment.LEFT); table.addCell(cellLibelle2); return table; }
From source file:com.isw.cec.Servlet.GenerarFoliosServlet.java
License:Open Source License
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String appPath = request.getServletContext().getRealPath(""); String savePath = appPath + File.separator + SAVE_DIR; File fileSaveDir = new File(savePath); if (!fileSaveDir.exists()) fileSaveDir.mkdirs();/*from ww w .java 2 s . c o m*/ String fileName = java.util.UUID.randomUUID().toString() + ".pdf"; Curso curso = (Curso) request.getAttribute("curso"); List<Entry<String, String>> alum_fol = Reader.getAlumFolios(curso.getID()); OutputStream fos = new FileOutputStream(savePath + File.separator + fileName); PdfWriter writer = new PdfWriter(fos); PdfDocument pdf = new PdfDocument(writer); Document document = new Document(pdf, PageSize.A4); document.setMargins(85, 57, 71, 71); PdfFont font = PdfFontFactory.createFont(FontConstants.TIMES_ROMAN); PdfFont bold = PdfFontFactory.createFont(FontConstants.TIMES_BOLD); Paragraph p = new Paragraph("Folios de los alumnos inscritos al curso"); p.setTextAlignment(TextAlignment.CENTER); document.add(p); p = new Paragraph(curso.getNombre()); p.setFont(bold); p.setTextAlignment(TextAlignment.CENTER); p.setMarginBottom(70); document.add(p); Table table = new Table(new float[] { 1, 1 }); table.setWidthPercent(100); Cell c = new Cell().add(new Paragraph("ALUMNO").setFont(bold)); c.setTextAlignment(TextAlignment.CENTER); table.addHeaderCell(c); c = new Cell().add(new Paragraph("FOLIO").setFont(bold)); c.setTextAlignment(TextAlignment.CENTER); table.addHeaderCell(c); for (Entry<String, String> e : alum_fol) { table.addCell(new Cell().add(new Paragraph(e.getKey()).setFont(font))); table.addCell(new Cell().add(new Paragraph(e.getValue()).setFont(font))); } document.add(table); document.close(); Writer.openCurso(curso.getID(), fileName); response.getWriter().println("OK"); }
From source file:controller.PasesDeCortesiaController.java
private void generaTitulo(Document document, String text) throws IOException { Table t = new Table(1); Cell c = new Cell(); c.setTextAlignment(TextAlignment.CENTER); c.setFont(PdfFontFactory.createRegisteredFont("times-italic")); c.setFontSize(18);//from w w w . j a v a 2 s. c om c.setFontColor(Color.BLACK); c.add("\n"); c.add(text); c.setBorder(Border.NO_BORDER); c.setBorderBottom(new SolidBorder(Color.GRAY, 1)); t.addCell(c); document.add(t); }
From source file:controller.PasesDeCortesiaController.java
public Cell generaCeldaNegra(String txt) throws IOException { Cell c = new Cell(); c.setFont(PdfFontFactory.createRegisteredFont("times-italic")); c.setFontSize(8);/*from w ww . j ava2s.c om*/ c.setTextAlignment(TextAlignment.CENTER); c.setBackgroundColor(Color.BLACK); c.setFontColor(Color.WHITE); c.add(txt); return c; }
From source file:controller.PasesDeCortesiaController.java
private Cell generaCeldaNormal(String txt) throws IOException { Cell c = new Cell(); c.setBorder(Border.NO_BORDER); c.setFont(PdfFontFactory.createRegisteredFont("times-italic")); c.setFontSize(8);//from ww w .ja v a2s. com c.setTextAlignment(TextAlignment.CENTER); if (txt != null) { c.add(txt); } return c; }