List of usage examples for com.itextpdf.text.pdf PdfPTable setWidths
public void setWidths(final int relativeWidths[]) throws DocumentException
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntotres() throws Exception { PdfPTable Dos_tres = new PdfPTable(5); Dos_tres.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Actividad 2.3" + " - Eventos Acadmicos", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Nombre del evento")); 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 w w w. j av a2 s. c om*/ Titulo_tabla.setExtraParagraphSpace(15f); Dos_tres.addCell(Titulo_tabla); Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ /**Get actual period***/ int periodo = 0; String id_evento = null, even = null, puntaje = null, comentarios = null; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ ResultSet rb = lb.executeQuery("SELECT * FROM profesor_tiene_pub WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado = 0) AND periodo = " + periodo + " AND " + "(id_tipo_pub = 6 OR id_tipo_pub = 7 OR id_tipo_pub = 8)"); while (rb.next()) { id_evento = rb.getString("id_evento"); Dos_tres.addCell(id_evento); Dos_tres.addCell("Evento acadmico"); Anchor anchor = new Anchor("Constancia"); anchor.setReference(rb.getString("ruta_alm")); //anchor.setReference("file:///"+rb.getString("ruta_alm")); Dos_tres.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_tres.addCell(puntaje); comentarios = rb.getString("comentarios"); Dos_tres.addCell(comentarios); } return Dos_tres; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntocuatro() throws Exception { PdfPTable Dos_cuatro = new PdfPTable(5); Dos_cuatro.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Actividad 2.4" + " - Investigacin y/o Desarrollo Satisfactorio", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("ID del proyecto SIP")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); 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 w ww . j a v a 2 s . c o m Titulo_tabla.setExtraParagraphSpace(15f); Dos_cuatro.addCell(Titulo_tabla); Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_pr = null, puntaje = null, comenta = null; ResultSet rb = lb.executeQuery("SELECT count(*), id_proyecto, ruta_alm, puntaje, comentarios " + "FROM profesor_tiene_proyecto " + "WHERE id_usuario = " + getUsername() + " AND " + "(validado = 1 OR validado = 0) AND periodo = " + periodo + " GROUP BY id_proyecto " + "HAVING COUNT(*) > 0"); /* SELECT count(*), id_proyecto, ruta_alm, puntaje, comentarios FROM profesor_tiene_proyecto WHERE id_usuario = 11014 AND aceptado = 1 AND validado = 1 GROUP BY id_proyecto HAVING COUNT(*) > 1; */ while (rb.next()) { Dos_cuatro.addCell("2.4.2"); id_pr = rb.getString("id_proyecto"); Dos_cuatro.addCell(id_pr); Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference(rb.getString("ruta_alm")); Dos_cuatro.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_cuatro.addCell(puntaje); comenta = rb.getString("comentarios"); Dos_cuatro.addCell(comenta); } return Dos_cuatro; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntocinco() throws Exception { PdfPTable Dos_cinco = new PdfPTable(5); Dos_cinco.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Actividad 2.5.2" + " - Derechos de Autor", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Identificador de obra")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); 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);/* ww w . j a v a 2 s . c o m*/ Titulo_tabla.setExtraParagraphSpace(15f); Dos_cinco.addCell(Titulo_tabla); Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_obra = null, puntaje = null, comenta = null; ResultSet rb = lb.executeQuery("SELECT * FROM profesor_tiene_obra WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado=0 ) AND periodo = " + periodo); while (rb.next()) { Dos_cinco.addCell("2.5"); id_obra = rb.getString("id_obra"); Dos_cinco.addCell(id_obra); Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference(rb.getString("ruta_alm")); Dos_cinco.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_cinco.addCell(puntaje); comenta = rb.getString("comentarios"); Dos_cinco.addCell(comenta); } return Dos_cinco; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntoonce() throws Exception { PdfPTable Dos_once = new PdfPTable(5); Dos_once.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Actividad 2.11" + " - Direcciones y Codirecciones", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Identificador de TT o tesis")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); 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 w ww.j a v a 2s. c o m Titulo_tabla.setExtraParagraphSpace(15f); Dos_once.addCell(Titulo_tabla); Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_tt = null, puntaje = null, comenta = null; ResultSet rb = lb.executeQuery("SELECT * FROM profesor_tiene_tt WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado = 0) AND periodo = " + periodo); while (rb.next()) { Dos_once.addCell("2.11"); id_tt = rb.getString("id_TT"); Dos_once.addCell(id_tt); Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference(rb.getString("ruta_alm")); Dos_once.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_once.addCell(puntaje); comenta = rb.getString("comentarios"); Dos_once.addCell(comenta); } return Dos_once; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntodoce() throws Exception { PdfPTable Dos_doce = new PdfPTable(5); Dos_doce.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase( "Actividad 2.12" + " - Coordinacin o Participacin en la elaboracin o actualizacin" + "de un plan de estudios", encabezadost));/*from w w w . j a va 2s .c o m*/ //PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Identificador de Plan de estudios")); PdfPCell Tipo_parti = new PdfPCell(new Phrase("Tipo de participacin** (Ver parte de abajo)")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); //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); Titulo_tabla.setExtraParagraphSpace(15f); Dos_doce.addCell(Titulo_tabla); /*Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Num_Actividad);*/ Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Tipo_Actividad); Tipo_parti.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_parti.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Tipo_parti); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_part = null, id_tipo = null, puntaje = null, comenta = null; ResultSet rb = lb.executeQuery("SELECT * FROM profesor_participa_en_plan WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado = 0) AND periodo = " + periodo /*AND periodo = que el que tiene registrado el profesor*/); while (rb.next()) { //Dos_doce.addCell("2.12"); id_part = rb.getString("id_part"); Dos_doce.addCell(id_part); id_tipo = rb.getString("id_tipo_part"); Dos_doce.addCell(id_tipo);//Agregar a la parte de abajo el tipo de prticicin Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference("file:///" + rb.getString("ruta_alm")); anchor.setReference("Constancia"); Dos_doce.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_doce.addCell(puntaje); comenta = rb.getString("comentarios"); Dos_doce.addCell(comenta); } return Dos_doce; }
From source file:pdf.GeradorPDF.java
private PdfPTable createTable(Pagamento pagamento, DadosEspecificos dados) throws DocumentException { int colunas = 7 + pagamento.getBeneficios().size(); PdfPTable table = new PdfPTable(colunas); PdfPCell cell;//from ww w. j ava2s .com cell = new PdfPCell(new Phrase("Cmpus: " + pagamento.getTurma().getCampusOfertante() + " Ms: " + pagamento.getMes() + " Planilha: " + dados.getNroPanilha())); cell.setColspan(colunas); table.addCell(cell); cell = new PdfPCell(new Phrase("Nome do curso: " + pagamento.getTurma().getCurso().getNome() + " Cdigo SISTEC: " + dados.getSistec() + " LC: " + dados.getLc())); cell.setColspan(colunas); table.addCell(cell); SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); cell = new PdfPCell(new Phrase("Data de inicio do curso: " + df.format(pagamento.getTurma().getDataInicioAulas()).replace("00:00:00", "") + " Fim previsto do curso: " + df.format(pagamento.getTurma().getDataTerminoAulas()).replace("00:00:00", ""))); cell.setColspan(colunas); table.addCell(cell); table.addCell("Nome"); table.addCell("CPF"); table.addCell("Banco"); table.addCell("Agncia"); table.addCell("Conta"); for (Beneficio b : pagamento.getBeneficios()) { table.addCell(b.getTipo() + " R$"); } table.addCell("Faltas R$"); table.addCell("Valor Total R$"); double totalFaltas = 0.0, totalBeneficio = 0.0, valorBeneficio; for (Aluno aluno : pagamento.getAlunos()) { if (aluno.isRecece()) { table.addCell(aluno.getNome()); table.addCell(aluno.getCpf()); table.addCell(aluno.getContaBancaria().getNomeBanco()); table.addCell(aluno.getContaBancaria().getAgencia() + ""); table.addCell(aluno.getContaBancaria().getNumeroConta() + ""); for (Beneficio beneficio : pagamento.getBeneficios()) { valorBeneficio = (pagamento.getDiasLetivos() - aluno.getFaltas()) * beneficio.getValor(); table.addCell("R$ " + valorBeneficio); } table.addCell("R$ " + aluno.getValorDescontado()); totalFaltas += aluno.getValorDescontado(); table.addCell("R$ " + aluno.getValorRecebido()); } } table.addCell("Total"); table.addCell(""); table.addCell(""); table.addCell(""); table.addCell(""); for (Beneficio b : pagamento.getBeneficios()) { try { totalBeneficio = new PagamentoDAO().recuperarTotalPagoPorBeneficio(b.getId(), pagamento.getId()); } catch (SQLException ex) { Logger.getLogger(GeradorPDF.class.getName()).log(Level.SEVERE, null, ex); } table.addCell("R$ " + totalBeneficio); } table.addCell("R$ " + totalFaltas); table.addCell("R$ " + pagamento.getValorAPagarPorTurma()); float[] columnWidths = new float[0]; if (colunas == 9) { columnWidths = new float[] { 27f, 18f, 8f, 10f, 13f, 15f, 15f, 13f, 15f }; } else if (colunas == 8) { columnWidths = new float[] { 27f, 18f, 9f, 12f, 13f, 15f, 13f, 17f }; } table.setWidths(columnWidths); return table; }
From source file:pdf.PDFDesign.java
private PdfPTable createLine3Table(Item item, int s1, int s2, int s3) throws DocumentException { if (s1 != 0 && s1 != 0 && s3 != 0) { bigPriceNumberFont.setSize(s1);/* w w w. ja v a 2 s . co m*/ decimalPriceNumberFont.setSize(s2); decimalPriceNumberFont.setSize(s3); } else { bigPriceNumberFont.setSize(70); } Paragraph p3 = new Paragraph(); p3.setFont(bigPriceNumberFont); p3.add(item.getPrice().substring(0, item.getPrice().length() - 3)); Paragraph p3_2 = new Paragraph(); p3_2.setFont(decimalPriceNumberFont); p3_2.add(item.getPrice().substring(item.getPrice().length() - 2, item.getPrice().length())); Paragraph p3_3 = new Paragraph(); p3_3.setFont(decimalPriceNumberFont); p3_3.add(item.getCurrency()); PdfPTable table = new PdfPTable(2); if (item.getPrice().length() == 6) { table.setWidths(new float[] { 2.8f, 1 }); } else if (item.getPrice().length() == 5) { table.setWidths(new float[] { 1.8f, 1 }); } else { table.setWidths(new float[] { 1.5f, 1 }); } PdfPCell cell = new PdfPCell(p3); cell.setRowspan(2); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); if (s1 != 0 && s1 != 0 && s3 != 0) { cell.setLeading(42.0f, 0f); } else { cell.setLeading(55.0f, 0f); } cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(p3_2); cell.setRowspan(1); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(p3_3); cell.setRowspan(1); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(0); table.addCell(cell); return table; }
From source file:pdf.PDFDesign.java
private PdfPCell createEuroInnerPrice(Item item) throws DocumentException { PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100f);//w w w . j av a2 s .co m table.setWidths(new float[] { 1f, 1f }); table.addCell(createEuroInnerInnerPrice(item.getPrice(), item.getCurrency(), true)); table.addCell(createEuroInnerInnerPrice(item.getSecondPrice(), item.getSecondCurrency(), false)); PdfPCell finalCell = new PdfPCell(table); finalCell.setFixedHeight(57f); finalCell.setLeading(20f, 0f); finalCell.setBorder(0); 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;/*from w w w . ja v a 2 s .co m*/ 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_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 w w . ja v a 2s . 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; }