List of usage examples for com.itextpdf.text BaseColor BaseColor
public BaseColor(final float red, final float green, final float blue)
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_TT() throws Exception { PdfPTable tabla_num = new PdfPTable(2); int a = 0, b = 0, c = 0, d = 0; String numberAsString;/*from www . j a v a2s . co m*/ tabla_num.setWidths(new int[] { 2, 2 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("TT o tesis aceptados y rechazados", encabezadost)); PdfPCell aceptado = new PdfPCell(new Phrase("Aceptados")); PdfPCell no_aceptado = new PdfPCell(new Phrase("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); aceptado.setHorizontalAlignment(Element.ALIGN_CENTER); aceptado.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(aceptado); no_aceptado.setHorizontalAlignment(Element.ALIGN_CENTER); no_aceptado.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(no_aceptado); /*Aqui van las consultas de las Actividades del profesor*/ a = getNum2_11(2); numberAsString = Integer.toString(a); tabla_num.addCell(numberAsString); b = getNum2_11(3); numberAsString = Integer.toString(b); tabla_num.addCell(numberAsString); return tabla_num; }
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_plan_estu() throws Exception { PdfPTable tabla_num = new PdfPTable(8); int a = 0, b = 0, c = 0, d = 0, e, f, g, h; String numberAsString;/*from w w w. j a v a 2s . c o m*/ tabla_num.setWidths(new int[] { 2, 2, 2, 2, 2, 2, 2, 2 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Participaciones aceptadas", encabezadost)); PdfPCell coor_1 = new PdfPCell(new Phrase("Coord 1")); PdfPCell coor_2 = new PdfPCell(new Phrase("Corrd 2")); PdfPCell parti_1 = new PdfPCell(new Phrase("Parti 1")); PdfPCell parti_2 = new PdfPCell(new Phrase("Parti 2")); PdfPCell coor_1_1 = new PdfPCell(new Phrase("Coord 1 1")); PdfPCell coor_1_2 = new PdfPCell(new Phrase("Coord 1 2")); PdfPCell parti_1_1 = new PdfPCell(new Phrase("Parti 1 1")); PdfPCell parti_1_2 = new PdfPCell(new Phrase("Parti 1 2")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(8); Titulo_tabla.setExtraParagraphSpace(15f); tabla_num.addCell(Titulo_tabla); coor_1.setHorizontalAlignment(Element.ALIGN_CENTER); coor_1.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(coor_1); coor_2.setHorizontalAlignment(Element.ALIGN_CENTER); coor_2.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(coor_2); parti_1.setHorizontalAlignment(Element.ALIGN_CENTER); parti_1.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(parti_1); parti_2.setHorizontalAlignment(Element.ALIGN_CENTER); parti_2.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(parti_2); coor_1_1.setHorizontalAlignment(Element.ALIGN_CENTER); coor_1_1.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(coor_1_1); coor_1_2.setHorizontalAlignment(Element.ALIGN_CENTER); coor_1_2.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(coor_1_2); parti_1_1.setHorizontalAlignment(Element.ALIGN_CENTER); parti_1_1.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(parti_1_1); parti_1_2.setHorizontalAlignment(Element.ALIGN_CENTER); parti_1_2.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(parti_1_2); /*Aqui van las consultas de las Actividades del profesor*/ a = getNum2_12(2); numberAsString = Integer.toString(a); tabla_num.addCell(numberAsString); b = getNum2_12(3); numberAsString = Integer.toString(b); tabla_num.addCell(numberAsString); c = getNum2_12(4); numberAsString = Integer.toString(c); tabla_num.addCell(numberAsString); d = getNum2_12(5); numberAsString = Integer.toString(d); tabla_num.addCell(numberAsString); e = getNum2_12(6); numberAsString = Integer.toString(e); tabla_num.addCell(numberAsString); f = getNum2_12(7); numberAsString = Integer.toString(f); tabla_num.addCell(numberAsString); g = getNum2_12(8); numberAsString = Integer.toString(g); tabla_num.addCell(numberAsString); h = getNum2_12(9); numberAsString = Integer.toString(h); tabla_num.addCell(numberAsString); return tabla_num; }
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_acota1() throws Exception { PdfPTable tabla_num = new PdfPTable(2); int a = 0, b = 0, c = 0, d = 0, e, f, g, h; String numberAsString;//www . jav a 2 s .c o m tabla_num.setWidths(new int[] { 1, 5 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Acotaciones de Participaciones", encabezadost)); PdfPCell abre = new PdfPCell(new Phrase("Abreviatura")); PdfPCell signi = new PdfPCell(new Phrase("Significado")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(8); Titulo_tabla.setExtraParagraphSpace(15f); tabla_num.addCell(Titulo_tabla); abre.setHorizontalAlignment(Element.ALIGN_CENTER); abre.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(abre); signi.setHorizontalAlignment(Element.ALIGN_CENTER); signi.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(signi); /*Aqui van las consultas de las Actividades del profesor*/ tabla_num.addCell("Coord 1"); tabla_num.addCell("Coordinacin en la elaboracin de un plan de estudios"); tabla_num.addCell("Coor 2"); tabla_num.addCell("Coordinacin en la actualizacin de un plan de estudios"); tabla_num.addCell("Parti 1"); tabla_num.addCell("Participacin en la elaboracin de un plan de estudios"); tabla_num.addCell("Parti 2"); tabla_num.addCell("Participacin en la actualizacin de un plan de estudios"); tabla_num.addCell("Coor 1 1"); tabla_num.addCell("Coordinacin en la elaboracin de un programa de estudios"); tabla_num.addCell("Coor 1 2"); tabla_num.addCell("Coordinacin en la actualizacin de un programa de estudios"); tabla_num.addCell("Parti 1 1"); tabla_num.addCell("Participacin en la elaboracin de un programa de estudios"); tabla_num.addCell("Parti 1 2"); tabla_num.addCell("Participacin en la actualizacin de un programa de estudios"); return tabla_num; }
From source file:printers.AbstractHorariosPrinter.java
License:Open Source License
private PdfPCell createCeldaHorarioItem(HorarioItem h, int fila, int columna, int numColumnas, int numFilas) { Paragraph p;// ww w .j a v a 2 s .com PdfPCell c; if (!h.isHuecoLibre()) { p = getParagraphForAsignatura(h); c = new PdfPCell(p); c.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); c.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //Color col = h.getAsignatura().getColorEnTablaDeHorarios(); Color col = h.getTramo().getColorEnTablaDeHorarios(); c.setBackgroundColor(new BaseColor(col.getRed(), col.getGreen(), col.getBlue())); c.setPadding(5); c.setBorderColor(BaseColor.BLACK); c.setBorderWidth(1); c.setUseBorderPadding(false); c.setUseVariableBorders(true); } else { p = new Paragraph("");//"C"+h.getNumcasilla()+" D"+h.getDiaSemana()+" "+h.getRangoHoras().getInicio()); c = new PdfPCell(p); c.setUseVariableBorders(true); c.setBorderColor(BaseColor.LIGHT_GRAY); c.setBorderWidth(.3F); // c.setBorder(Rectangle.NO_BORDER); if (columna == numColumnas - 1) { c.setBorderColorRight(BaseColor.BLACK); } // if (fila == numFilas - 1) { // c.setBorder(Rectangle.BOTTOM); // } // if ((columna == numColumnas - 1) && (fila == numFilas - 1)) { // c.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT); // } } if (h.getNumeroDeCasillasQueOcupa() > 1) { c.setRowspan(h.getNumeroDeCasillasQueOcupa()); } return c; }
From source file:relatorios.RelatorioCliente.java
public static void gerarRelatorio() throws ClassNotFoundException { // criao do objeto documento Document document = new Document(PageSize.A4, 30, 20, 20, 30); Connection conecta; // o objeto que conecta com o banco de dados PreparedStatement pst;//from w w w .ja v a 2 s .c om ResultSet rs; conecta = ConectaBd.conectabd(); OutputStream output; try { output = new FileOutputStream("relatorios/Relatrio de Clientes.pdf"); try { PdfWriter.getInstance(document, output); document.open(); // adicionando um pargrafo ao documento document.add(new Paragraph(" Relatrio de Clientes")); document.add(new Paragraph("\n")); Font bfBold10 = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD, new BaseColor(0, 0, 0)); Font bfBold12 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL, new BaseColor(0, 0, 0)); Font bf8 = new Font(Font.FontFamily.TIMES_ROMAN, 8); PdfPTable tabela = new PdfPTable(6); PdfPCell cell; cell = new PdfPCell(new Phrase("Nome", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("CPF", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Endereo", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Cidade", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("UF", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Telefone", bfBold10)); tabela.addCell(cell); String sql = "Select * from clientes order by codigo Asc"; //orderna pelo numero do codigo ascendentemente try { pst = conecta.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { String fornec = rs.getString("nome"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("cpf"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("endereco"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("cidade"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("uf"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("telefone"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); } } catch (SQLException error) { JOptionPane.showMessageDialog(null, error); } document.add(tabela); document.close(); } catch (DocumentException de) { System.err.println(de.getMessage()); document.close(); } } catch (FileNotFoundException ex) { Logger.getLogger(RelatorioFornecedor.class.getName()).log(Level.SEVERE, null, ex); System.err.println(ex.getMessage()); } }
From source file:relatorios.RelatorioCompra.java
public static void gerarRelatorio(String sql) throws ClassNotFoundException { // criao do objeto documento Document document = new Document(PageSize.A4, 30, 20, 20, 30); Connection conecta; // o objeto que conecta com o banco de dados PreparedStatement pst;/*from w ww . j a v a 2 s .c o m*/ ResultSet rs; conecta = ConectaBd.conectabd(); OutputStream output; try { output = new FileOutputStream("relatorios/Relatrio de Compras.pdf"); try { PdfWriter.getInstance(document, output); document.open(); // adicionando um pargrafo ao documento document.add(new Paragraph(" Relatrio de Compras")); document.add(new Paragraph("\n")); Font bfBold10 = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD, new BaseColor(0, 0, 0)); Font bfBold12 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL, new BaseColor(0, 0, 0)); Font bf8 = new Font(Font.FontFamily.TIMES_ROMAN, 6); PdfPTable tabela = new PdfPTable(6); PdfPCell cell; cell = new PdfPCell(new Phrase("Fornecedor", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Produto", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Qtde do Produto", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Valor por Unidade", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Valor Total", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Data", bfBold10)); tabela.addCell(cell); try { pst = conecta.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { String fornec = rs.getString("fornecedor"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("produto"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("quantidade"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("valorunitariocompra"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("valortotalcompra"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("data_compra"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); } } catch (SQLException error) { JOptionPane.showMessageDialog(null, error); } document.add(tabela); document.close(); } catch (DocumentException de) { System.err.println(de.getMessage()); document.close(); } } catch (FileNotFoundException ex) { Logger.getLogger(RelatorioCompra.class.getName()).log(Level.SEVERE, null, ex); System.err.println(ex.getMessage()); } }
From source file:relatorios.RelatorioFornecedor.java
public static void gerarRelatorio() throws ClassNotFoundException { // criao do objeto documento Document document = new Document(PageSize.A4, 30, 20, 20, 30); Connection conecta; // o objeto que conecta com o banco de dados PreparedStatement pst;/*w w w . j a v a 2s .c o m*/ ResultSet rs; conecta = ConectaBd.conectabd(); OutputStream output; try { output = new FileOutputStream("relatorios/Relatrio de Fornecedores.pdf"); try { PdfWriter.getInstance(document, output); document.open(); // adicionando um pargrafo ao documento document.add(new Paragraph(" Relatrio de Fornecedores")); document.add(new Paragraph("\n")); Font bfBold10 = new Font(FontFamily.TIMES_ROMAN, 10, Font.BOLD, new BaseColor(0, 0, 0)); Font bfBold12 = new Font(FontFamily.TIMES_ROMAN, 8, Font.NORMAL, new BaseColor(0, 0, 0)); Font bf8 = new Font(FontFamily.TIMES_ROMAN, 8); PdfPTable tabela = new PdfPTable(7); PdfPCell cell; cell = new PdfPCell(new Phrase("Fornecedor", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("CPF", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("CNPJ", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Endereo", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Cidade", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Email", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Telefone", bfBold10)); tabela.addCell(cell); String sql = "Select * from fornecedores order by codigo Asc"; //orderna pelo numero do codigo ascendentemente try { pst = conecta.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { String fornec = rs.getString("fornecedor"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("cpf"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("cnpj"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("endereco"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("cidade"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("email"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("telefone"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); } } catch (SQLException error) { JOptionPane.showMessageDialog(null, error); } document.add(tabela); document.close(); } catch (DocumentException de) { System.err.println(de.getMessage()); document.close(); } } catch (FileNotFoundException ex) { Logger.getLogger(RelatorioFornecedor.class.getName()).log(Level.SEVERE, null, ex); System.err.println(ex.getMessage()); } }
From source file:relatorios.RelatorioFuncionario.java
public static void gerarRelatorio() throws ClassNotFoundException { // criao do objeto documento Document document = new Document(PageSize.A4, 30, 20, 20, 30); Connection conecta; // o objeto que conecta com o banco de dados PreparedStatement pst;/*from www. j a va 2s . co m*/ ResultSet rs; conecta = ConectaBd.conectabd(); OutputStream output; try { output = new FileOutputStream("relatorios/Relatrio de Funcionarios.pdf"); try { PdfWriter.getInstance(document, output); document.open(); // adicionando um pargrafo ao documento document.add(new Paragraph(" Relatrio de Funcionarios")); document.add(new Paragraph("\n")); Font bfBold10 = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD, new BaseColor(0, 0, 0)); Font bfBold12 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL, new BaseColor(0, 0, 0)); Font bf8 = new Font(Font.FontFamily.TIMES_ROMAN, 8); PdfPTable tabela = new PdfPTable(3); PdfPCell cell; cell = new PdfPCell(new Phrase("Nome", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Telefone", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Usuario", bfBold10)); tabela.addCell(cell); String sql = "Select * from funcionarios order by codigo Asc"; //orderna pelo numero do codigo ascendentemente try { pst = conecta.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { String fornec = rs.getString("nome"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("telefone"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("usuario"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); } } catch (SQLException error) { JOptionPane.showMessageDialog(null, error); } document.add(tabela); document.close(); } catch (DocumentException de) { System.err.println(de.getMessage()); document.close(); } } catch (FileNotFoundException ex) { Logger.getLogger(RelatorioFornecedor.class.getName()).log(Level.SEVERE, null, ex); System.err.println(ex.getMessage()); } }
From source file:relatorios.RelatorioProdutos.java
public static void gerarRelatorio() throws ClassNotFoundException { // criao do objeto documento Document document = new Document(PageSize.A4, 30, 20, 20, 30); Connection conecta; // o objeto que conecta com o banco de dados PreparedStatement pst;/*w w w. j a va 2 s . co m*/ ResultSet rs; conecta = ConectaBd.conectabd(); OutputStream output; try { output = new FileOutputStream("relatorios/Relatrio de Produtos.pdf"); try { PdfWriter.getInstance(document, output); document.open(); // adicionando um pargrafo ao documento document.add(new Paragraph(" Relatrio de Produtos")); document.add(new Paragraph("\n")); Font bfBold10 = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD, new BaseColor(0, 0, 0)); Font bfBold12 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL, new BaseColor(0, 0, 0)); Font bf8 = new Font(Font.FontFamily.TIMES_ROMAN, 8); PdfPTable tabela = new PdfPTable(4); PdfPCell cell; cell = new PdfPCell(new Phrase("Nome", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Valor de Compra", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Valor de Venda", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Qtde. em Estoque", bfBold10)); tabela.addCell(cell); String sql = "Select * from produtos_float order by codigo Asc"; //orderna pelo numero do codigo ascendentemente try { pst = conecta.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { String fornec = rs.getString("descricao"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("valor_compra"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("valor_venda"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("estoque"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); } } catch (SQLException error) { JOptionPane.showMessageDialog(null, error); } document.add(tabela); document.close(); } catch (DocumentException de) { System.err.println(de.getMessage()); document.close(); } } catch (FileNotFoundException ex) { Logger.getLogger(RelatorioProdutos.class.getName()).log(Level.SEVERE, null, ex); System.err.println(ex.getMessage()); } }
From source file:relatorios.RelatorioVenda.java
public static void gerarRelatorio(String sql) throws ClassNotFoundException { // criao do objeto documento Document document = new Document(PageSize.A4, 30, 20, 20, 30); Connection conecta; // o objeto que conecta com o banco de dados PreparedStatement pst;/*from ww w . java 2 s. c om*/ ResultSet rs; conecta = ConectaBd.conectabd(); OutputStream output; try { output = new FileOutputStream("relatorios/Relatrio de Venda.pdf"); try { PdfWriter.getInstance(document, output); document.open(); // adicionando um pargrafo ao documento document.add(new Paragraph(" Relatrio de Venda")); document.add(new Paragraph("\n")); Font bfBold10 = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD, new BaseColor(0, 0, 0)); Font bfBold12 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL, new BaseColor(0, 0, 0)); Font bf8 = new Font(Font.FontFamily.TIMES_ROMAN, 6); PdfPTable tabela = new PdfPTable(6); PdfPCell cell; cell = new PdfPCell(new Phrase("Cliente", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Produto", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Qtde do Produto", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Valor por Unidade", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Valor Total", bfBold10)); tabela.addCell(cell); cell = new PdfPCell(new Phrase("Data", bfBold10)); tabela.addCell(cell); try { pst = conecta.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { String fornec = rs.getString("cliente"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("produto"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("quantidade"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("valorunitariovenda"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("valortotalvenda"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); fornec = rs.getString("data_venda"); cell = new PdfPCell(new Phrase(fornec, bf8)); tabela.addCell(cell); } } catch (SQLException error) { JOptionPane.showMessageDialog(null, error); } document.add(tabela); document.close(); } catch (DocumentException de) { System.err.println(de.getMessage()); document.close(); } } catch (FileNotFoundException ex) { Logger.getLogger(RelatorioVenda.class.getName()).log(Level.SEVERE, null, ex); System.err.println(ex.getMessage()); } }