List of usage examples for com.itextpdf.text Font setSize
public void setSize(final float size)
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial4(List<TbMaterial> tbMaterials4, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.4 ?", font)); cell.setColspan(6);/*from ww w .j a v a 2 s .com*/ table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials4) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial5(List<TbMaterial> tbMaterials5, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "3.5 ??", font));// w ww. j a v a 2 s . c om cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials5) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial6(List<TbMaterial> tbMaterials6, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.6 ??", font)); cell.setColspan(6);/*from w ww .j a v a 2s .c o m*/ table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials6) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial7(List<TbMaterial> tbMaterials7, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.7 ", font)); cell.setColspan(6);/*from w ww .j a va 2 s . c om*/ table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials7) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial8(List<TbMaterial> tbMaterials8, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.8 ??", font)); cell.setColspan(6);//from w ww. j a v a 2 s. c om table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials8) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial9(List<TbMaterial> tbMaterials9, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.9 ", font)); cell.setColspan(6);//from ww w . j a va 2 s . c o m table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials9) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial10(List<TbMaterial> tbMaterials10, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.10 ???", font)); cell.setColspan(6);//from w w w. j a v a 2 s. c o m table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials10) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableMaterial11(List<TbMaterial> tbMaterials11, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.11 ", font)); cell.setColspan(6);// w w w. j a v a2 s . c o m table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials11) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtablePublicutility(List<TbPublicutility> tbPublicutilitys, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("4.1 ?", font)); cell.setColspan(6);/*from w w w . j a va 2 s . com*/ table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbPublicutility items : tbPublicutilitys) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getPubEle(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubWater(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubTel(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubEms(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubOther(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubSum(), font))); } return table; }
From source file:Controlador.ControladorClasificacion.java
/** * Mtodo generarPDF que genera el PDF con la clasificacin al pulsar el * botn generar PDF//from www .ja va 2 s . co m * * @throws FileNotFoundException salta la excepcion * @throws DocumentException salta la excepcion * @throws IOException salta la excepcion */ public void generarPDF() throws FileNotFoundException, DocumentException, IOException { Calendar cal = Calendar.getInstance(); String time = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(cal.getTime()); File file = new File("Clasificacion.pdf"); FileOutputStream fileout = new FileOutputStream(file.getAbsolutePath()); Document document = new Document(); PdfWriter.getInstance(document, fileout); Font fuente1 = new Font(); Font fuente2 = new Font(); Font fuente3 = new Font(); fuente1.setStyle(Font.BOLD | Font.ITALIC | Font.UNDERLINE); fuente1.setSize(18); fuente1.setColor(0, 51, 204); fuente2.setStyle(Font.BOLD | Font.ITALIC); fuente2.setColor(0, 51, 204); fuente2.setSize(13); fuente3.setStyle(Font.BOLD | Font.ITALIC); fuente3.setSize(16); fuente3.setColor(255, 153, 0); document.open(); Paragraph pa = new Paragraph("Fecha y hora: " + time); pa.setAlignment(Element.ALIGN_RIGHT); document.add(pa); /*String url = "imagenPDF.jpg"; File file2 = new File(url); FileInputStream filein = new FileInputStream(file2.getAbsolutePath()); //String url = "./imagenPDF.jpg"; Image imagen = Image.getInstance(filein.getFD()); //System.out.println(file2.getAbsolutePath()); imagen.scalePercent(20); document.add(imagen);*/ document.add(new Paragraph("\n")); Paragraph p3 = new Paragraph("GESTOR DE CAMPEONATO DE BALONCESTO", fuente1); p3.setAlignment(Element.ALIGN_CENTER); document.add(p3); document.add(new Paragraph("\n")); String tipo_competicion = FicherosTipo.leerFichero(); if (tipo_competicion.contains("Copa")) { Paragraph pa1 = new Paragraph("COPA", fuente3); pa1.setAlignment(Element.ALIGN_CENTER); document.add(pa1); document.add(new Paragraph( "---------------------------------------------------------------------------------------------------------------------------------")); document.add(new Paragraph("\n")); int jornada_maxima = PartidoDAO.obtenerJornadaActual(); for (int i = jornada_maxima; i > 0; i--) { List<Partido> listarPartidosJornada = PartidoDAO.listarPartidosJornada(i); for (Partido p : listarPartidosJornada) { List<PartidoJugado> listarEquiposporPartido = PartidoJugadoDAO .listarEquiposporPartido(p.getIdPartido()); int equipoA = listarEquiposporPartido.get(0).getIdEquipo(); int equipoB = listarEquiposporPartido.get(1).getIdEquipo(); Paragraph p2 = new Paragraph( "Equipo A: " + EquipoDAO.obtenerNombreEquipo(equipoA) + " - Equipo B: " + EquipoDAO.obtenerNombreEquipo(equipoB) + " - Resultado: " + p.getResultado(), fuente2); p2.setAlignment(Element.ALIGN_LEFT); document.add(p2); } } } else if (tipo_competicion.contains("Liga")) { Paragraph pa1 = new Paragraph("LIGA", fuente3); pa1.setAlignment(Element.ALIGN_LEFT); document.add(pa1); document.add(new Paragraph( "---------------------------------------------------------------------------------------------------------------------------------")); document.add(new Paragraph("\n")); List<Equipo> obtenerTodosEquipos = EquipoDAO.obtenerTodosEquipos(); Collections.sort(obtenerTodosEquipos); System.out.println(obtenerTodosEquipos); for (Equipo p : obtenerTodosEquipos) { Paragraph pa2 = new Paragraph(p.getNombre(), fuente2); pa2.setAlignment(Element.ALIGN_LEFT); document.add(pa2); } } document.close(); File myfile = new File("Clasificacion.pdf"); Desktop.getDesktop().open(myfile); }