List of usage examples for com.itextpdf.text Font NORMAL
int NORMAL
To view the source code for com.itextpdf.text Font NORMAL.
Click Source Link
From source file:view.RelatorioDescricaoView.java
public void gerarDocumento() throws FileNotFoundException { try {//from w w w . ja va 2s . co m String descricao = tbeDescricao.getValueAt(tbeDescricao.getSelectedRow(), 0).toString(); listaPatrimonio = patrimonioDAO.listaTodosPorDescricao(descricao); doc = new Document(PageSize.A4, 41.5f, 41.5f, 55.2f, 55.2f); String caminho = "C:/Relatorios Descricao/Relatorio " + tbeDescricao.getValueAt(tbeDescricao.getSelectedRow(), 0).toString() + ".pdf"; PdfWriter.getInstance(doc, new FileOutputStream(caminho)); doc.open(); Font f1 = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD); Font f2 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD); Font f3 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD); Font f4 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD); Font f5 = new Font(Font.FontFamily.HELVETICA, 10, Font.NORMAL); Paragraph titulo1 = new Paragraph("Universidade do Estado de Minas Gerais", f2); titulo1.setAlignment(Element.ALIGN_CENTER); titulo1.setSpacingAfter(10); Paragraph titulo2 = new Paragraph( "" + tbeDescricao.getValueAt(tbeDescricao.getSelectedRow(), 0).toString(), f2); titulo2.setAlignment(Element.ALIGN_CENTER); titulo2.setSpacingAfter(10); doc.add(titulo1); doc.add(titulo2); PdfPTable tabela = new PdfPTable(new float[] { 0.20f, 0.80f, 0.18f, 0.42f }); tabela.setHorizontalAlignment(Element.ALIGN_CENTER); tabela.setWidthPercentage(100f); PdfPCell cabecalho1 = new PdfPCell(new Paragraph("Codigo", f3)); cabecalho1.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cabecalho1.setBorder(0); PdfPCell cabecalho2 = new PdfPCell(new Paragraph("Sala", f3)); cabecalho2.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cabecalho2.setBorder(0); PdfPCell cabecalho3 = new PdfPCell(new Paragraph("Estado", f3)); cabecalho3.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cabecalho3.setBorder(0); PdfPCell cabecalho4 = new PdfPCell(new Paragraph("Orgo", f3)); cabecalho4.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cabecalho4.setBorder(0); tabela.addCell(cabecalho1); tabela.addCell(cabecalho2); tabela.addCell(cabecalho3); tabela.addCell(cabecalho4); for (PatrimonioM patrimonio : listaPatrimonio) { Paragraph p1 = new Paragraph(patrimonio.getCodigo(), f5); p1.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col1 = new PdfPCell(p1); col1.setBorder(0); Paragraph p2 = new Paragraph(patrimonio.getSala().getDescricao(), f5); p2.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col2 = new PdfPCell(p2); col2.setBorder(0); Paragraph p3 = new Paragraph(patrimonio.getGrau_conservacao().getDescricao(), f5); p3.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col3 = new PdfPCell(p3); col3.setBorder(0); Paragraph p4 = new Paragraph(patrimonio.getEntidade().getNome(), f5); p4.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col4 = new PdfPCell(p4); col4.setBorder(0); tabela.addCell(col1); tabela.addCell(col2); tabela.addCell(col3); tabela.addCell(col4); } doc.add(tabela); doc.close(); JOptionPane.showMessageDialog(null, "Relatrio salvo com sucesso em C:/Relatorios Decricao/"); Desktop.getDesktop().open(new File(caminho)); } catch (DocumentException e) { e.printStackTrace(); } catch (SQLException ex) { ex.printStackTrace(); } catch (IOException exx) { exx.printStackTrace(); JOptionPane.showMessageDialog(null, "Documento de Relatorios aberto. Feche para gerar um novo."); } }
From source file:view.RelatorioSalaView.java
public void gerarDocumento() throws FileNotFoundException { try {//from w w w . j av a2 s. co m int numeroSala = Integer.parseInt(tbeSala.getValueAt(tbeSala.getSelectedRow(), 0).toString()); listaPatrimonio = patrimonioDAO.listaTodosSala(numeroSala); doc = new Document(PageSize.A4, 41.5f, 41.5f, 55.2f, 55.2f); String caminho = "C:/Relatorios Sala/Relatorio " + tbeSala.getValueAt(tbeSala.getSelectedRow(), 1).toString() + ".pdf"; PdfWriter.getInstance(doc, new FileOutputStream(caminho)); doc.open(); Font f1 = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD); Font f2 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD); Font f3 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD); Font f4 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD); Font f5 = new Font(Font.FontFamily.HELVETICA, 10, Font.NORMAL); Paragraph titulo1 = new Paragraph("Universidade do Estado de Minas Gerais", f2); titulo1.setAlignment(Element.ALIGN_CENTER); titulo1.setSpacingAfter(10); Paragraph titulo2 = new Paragraph("" + tbeSala.getValueAt(tbeSala.getSelectedRow(), 1).toString(), f2); titulo2.setAlignment(Element.ALIGN_CENTER); titulo2.setSpacingAfter(10); doc.add(titulo1); doc.add(titulo2); PdfPTable tabela = new PdfPTable(new float[] { 0.20f, 0.80f, 0.18f, 0.42f }); tabela.setHorizontalAlignment(Element.ALIGN_CENTER); tabela.setWidthPercentage(100f); PdfPCell cabecalho1 = new PdfPCell(new Paragraph("Codigo", f3)); cabecalho1.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cabecalho1.setBorder(0); PdfPCell cabecalho2 = new PdfPCell(new Paragraph("Descrio", f3)); cabecalho2.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cabecalho2.setBorder(0); PdfPCell cabecalho3 = new PdfPCell(new Paragraph("Estado", f3)); cabecalho3.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cabecalho3.setBorder(0); PdfPCell cabecalho4 = new PdfPCell(new Paragraph("Orgo", f3)); cabecalho4.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cabecalho4.setBorder(0); tabela.addCell(cabecalho1); tabela.addCell(cabecalho2); tabela.addCell(cabecalho3); tabela.addCell(cabecalho4); for (PatrimonioM patrimonio : listaPatrimonio) { if (patrimonio.getKit()) { listaComposto = patri.listaTodosExistentes(patrimonio); for (PatrimonioCompostoM composto : listaComposto) { Paragraph p1 = new Paragraph(patrimonio.getCodigo(), f5); p1.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col1 = new PdfPCell(p1); col1.setBorder(0); Paragraph p2 = new Paragraph(composto.getDescricao(), f5); p2.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col2 = new PdfPCell(p2); col2.setBorder(0); Paragraph p3 = new Paragraph(composto.getGrau().getDescricao(), f5); p3.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col3 = new PdfPCell(p3); col3.setBorder(0); Paragraph p4 = new Paragraph(patrimonio.getEntidade().getNome(), f5); p4.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col4 = new PdfPCell(p4); col4.setBorder(0); tabela.addCell(col1); tabela.addCell(col2); tabela.addCell(col3); tabela.addCell(col4); } } else { Paragraph p1 = new Paragraph(patrimonio.getCodigo(), f5); p1.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col1 = new PdfPCell(p1); col1.setBorder(0); Paragraph p2 = new Paragraph(patrimonio.getDescricao(), f5); p2.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col2 = new PdfPCell(p2); col2.setBorder(0); Paragraph p3 = new Paragraph(patrimonio.getGrau_conservacao().getDescricao(), f5); p3.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col3 = new PdfPCell(p3); col3.setBorder(0); Paragraph p4 = new Paragraph(patrimonio.getEntidade().getNome(), f5); p4.setAlignment(Element.ALIGN_JUSTIFIED); PdfPCell col4 = new PdfPCell(p4); col4.setBorder(0); tabela.addCell(col1); tabela.addCell(col2); tabela.addCell(col3); tabela.addCell(col4); } } doc.add(tabela); doc.close(); JOptionPane.showMessageDialog(null, "Relatrio salvo com sucesso em C:/Relatorios Sala/"); Desktop.getDesktop().open(new File(caminho)); } catch (DocumentException e) { e.printStackTrace(); } catch (SQLException ex) { ex.printStackTrace(); } catch (IOException exx) { exx.printStackTrace(); JOptionPane.showMessageDialog(null, "Documento de Relatorios aberto. Feche para gerar um novo."); } }
From source file:View.TelaRelatorio.java
public void GerarEntrega(int codigo) throws IOException { NegociosCompra nc = new NegociosCompra(); Compra compra = nc.ConsultarCompra(codigo); Document documentoPDF = new Document(); String output = "C:\\Users\\Marilia Nayara\\Documents\\NetBeansProjects\\SistemaInformao\\Relatorios\\VendasEntrega\\Compra" + codigo + ".pdf"; try {//from ww w. j a v a 2 s . co m PdfWriter.getInstance(documentoPDF, new FileOutputStream(output)); documentoPDF.open(); documentoPDF.setPageSize(PageSize.A4); Image imagem = Image.getInstance( "C:\\Users\\Marilia Nayara\\Documents\\NetBeansProjects\\SistemaInformao\\src\\View\\image.png"); imagem.scaleToFit(100, 75); imagem.setAlignment(Element.ALIGN_CENTER); documentoPDF.add(imagem); Font fonte1 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.BOLD); Paragraph agr = new Paragraph("Aplicao para Gesto de Restaurantes", fonte1); agr.setAlignment(Element.ALIGN_CENTER); documentoPDF.add(agr); Font fonte = new Font(Font.FontFamily.TIMES_ROMAN, 24, Font.BOLD); Paragraph cabecalho = new Paragraph("COMPRA ENTREGA", fonte); cabecalho.setAlignment(Element.ALIGN_CENTER); documentoPDF.add(cabecalho); documentoPDF.add(new Paragraph("\n")); Cliente c = new NegociosCliente().ProcurarCliente(compra.getCpf_c()); Timestamp t = compra.getData(); SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy"); String a = formato.format(t); PdfPTable dadosC = new PdfPTable(new float[] { 0.10f, 0.70f, 0.20f }); List<String> dados = new ArrayList<String>(); dados.add("CODIGO DA COMPRA"); dados.add("CLIENTE"); dados.add("DATA DA COMPRA"); dados.add("" + compra.getCodigo()); dados.add(c.getNome()); dados.add(a); for (String s : dados) { dadosC.addCell(s); } dadosC.setWidthPercentage(110f); documentoPDF.add(dadosC); documentoPDF.add(new Paragraph("\n")); /*documentoPDF.add(new Paragraph(" LISTA DE PRODUTOS COMPRADOS")); documentoPDF.add(new Paragraph("\n")); documentoPDF.add(new Paragraph("Codigo Produto Valor Unitrio Quantidade Valor ")); String tam = "Codigo Produto Valor Unitrio Quantidade Valor "; JOptionPane.showMessageDialog(null, tam.length()); for(int x=0;x<compra.getLista_prod().size();x++){ Produto p = new NegociosProduto().ProcurarProduto(compra.getLista_prod().get(x).intValue()); String cod = ""+p.getCodigo(); String nome = p.getNome(); float pv = p.getPvenda(); String pvs = ""+pv; int quant = compra.getQuantidades().get(x).intValue(); String squant = ""+quant; float pf = pv*quant; String spf = ""+pf; int espaco = 13 - cod.length(); String esp = ""; for(int y = 0;y <espaco;y++){ esp=esp+" "; } cod = cod+esp; espaco = 49 - nome.length(); esp = ""; for(int y = 0;y <espaco;y++){ esp=esp+" "; } nome = nome + esp; espaco = 24 - pvs.length(); esp = ""; for(int y = 0;y <espaco;y++){ esp=esp+" "; } pvs = pvs + esp; espaco = 23 - squant.length(); esp = ""; for(int y = 0;y <espaco;y++){ esp=esp+" "; } squant = squant + esp; espaco = 8 - spf.length(); esp = ""; for(int y = 0;y <espaco;y++){ esp=esp+" "; } spf = spf + esp; String fina = cod+nome+pvs+squant+spf; //JOptionPane.showMessageDialog(null, fina.length()); documentoPDF.add(new Paragraph(fina)); }*/ Font fonte3 = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.NORMAL); // Criando uma tabela com 3 colunas PdfPTable table = new PdfPTable(new float[] { 0.1f, 0.45f, 0.15f, 0.15f, 0.15f }); table.setWidthPercentage(110.f); // Ttulo para a tabela Paragraph tableHeader = new Paragraph("LISTA DE PRODUTOS COMPRADOS", fonte3); PdfPCell header = new PdfPCell(tableHeader); // Definindo que o header vai ocupar as 3 colunas header.setColspan(5); // Definindo alinhamento do header header.setHorizontalAlignment(Paragraph.ALIGN_CENTER); // Adicionando o header tabela table.addCell(header); List<String> list = new ArrayList<String>(); list.add("CODIGO"); list.add("PRODUTO"); list.add("VALOR UNIT?RIO"); list.add("QUANTIDADE"); list.add("VALOR"); for (int x = 0; x < compra.getLista_prod().size(); x++) { Produto p = new NegociosProduto().ProcurarProduto(compra.getLista_prod().get(x).intValue()); String cod = "" + p.getCodigo(); String nome = p.getNome(); float pv = p.getPvenda(); String pvs = "" + pv; int quant = compra.getQuantidades().get(x).intValue(); String squant = "" + quant; float pf = pv * quant; String spf = "" + pf; list.add(cod); list.add(nome); list.add(pvs); list.add(squant); list.add(spf); } for (String s : list) { table.addCell(s); } documentoPDF.add(table); documentoPDF.add(new Paragraph("\n")); Paragraph total = new Paragraph("Total: " + compra.getPreco_final(), fonte3); total.setAlignment(Element.ALIGN_RIGHT); documentoPDF.add(total); documentoPDF.add(new Paragraph("\n")); PdfPTable endereco = new PdfPTable(new float[] { 0.30f, 0.80f }); endereco.setWidthPercentage(60f); endereco.setHorizontalAlignment(Element.ALIGN_CENTER); Paragraph tableH = new Paragraph("ENDEREO DE ENTREGA", fonte3); PdfPCell hea = new PdfPCell(tableH); hea.setColspan(2); hea.setHorizontalAlignment(Paragraph.ALIGN_CENTER); endereco.addCell(hea); List<String> dadosE = new ArrayList<String>(); dadosE.add("LOGRADOURO"); dadosE.add(c.getEndereco().getRua()); dadosE.add("NUMERO"); dadosE.add("" + c.getEndereco().getNumero()); dadosE.add("BAIRRO"); dadosE.add(c.getEndereco().getBairro()); dadosE.add("CIDADE"); dadosE.add(c.getEndereco().getCidade()); dadosE.add("ESTADO"); dadosE.add(c.getEndereco().getEstado()); for (String s : dadosE) { endereco.addCell(s); } documentoPDF.add(endereco); documentoPDF.add(new Paragraph("\n")); documentoPDF .add(new Paragraph("Assinatura: __________________________________________________________")); Paragraph ass = new Paragraph("(" + c.getNome() + ")", fonte1); ass.setAlignment(Element.ALIGN_CENTER); documentoPDF.add(ass); documentoPDF.add(new Paragraph( "----------------------------------------------------------------------------------------------------------------------------------")); Paragraph comp = new Paragraph("COMPROVANTE DE ENTREGA"); comp.setAlignment(Element.ALIGN_CENTER); documentoPDF.add(comp); documentoPDF.add(new Paragraph("\n")); documentoPDF.add(dadosC); documentoPDF.add(total); documentoPDF .add(new Paragraph("Assinatura: __________________________________________________________")); documentoPDF.add(ass); } catch (DocumentException de) { de.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { documentoPDF.close(); java.awt.Desktop.getDesktop().open(new File(output)); } }
From source file:views.Clientes.java
private void btnImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImprimirActionPerformed try {/*from w w w. ja va 2 s.com*/ OutputStream file = new FileOutputStream(new File("C:\\CuotaSoft\\Historial.pdf")); Document document = new Document(); PdfWriter writer; writer = PdfWriter.getInstance(document, file); document.open(); // Se agrega titulo y datos del cliente Paragraph p = new Paragraph("Historial de Cliente \n", FontFactory.getFont("Arial", 16, Font.BOLD, BaseColor.BLACK)); p.setAlignment(Element.ALIGN_CENTER); Paragraph pNumero = new Paragraph("N Cliente: " + txtNroCliente.getText(), FontFactory.getFont("Arial", 12, Font.NORMAL, BaseColor.BLACK)); Paragraph pNombre = new Paragraph( "Nombre Cliente: " + txtNombre.getText() + " " + txtApellido.getText(), FontFactory.getFont("Arial", 12, Font.NORMAL, BaseColor.BLACK)); Paragraph pProductos = new Paragraph("Productos Comprados: ", FontFactory.getFont("Arial", 14, Font.BOLD, BaseColor.BLACK)); pProductos.setAlignment(Element.ALIGN_CENTER); Paragraph pSaldo = new Paragraph("Saldo: $" + txtSaldo.getText(), FontFactory.getFont("Arial", 14, Font.BOLD, BaseColor.BLACK)); pSaldo.setAlignment(Element.ALIGN_RIGHT); //se agregan paragraphs document.add(p); document.add(pNumero); document.add(pNombre); document.add(pSaldo); document.add(new Paragraph("\n")); document.add(pProductos); document.add(new Paragraph("\n")); //se agrega tabla productos PdfPTable pTablaProducto = new PdfPTable(4); float[] mediaCeldasProductos = { 3.30f, 3.50f, 3.50f, 3.70f }; pTablaProducto.setWidths(mediaCeldasProductos); pTablaProducto.addCell(new Paragraph("Producto", FontFactory.getFont("Arial", 12))); pTablaProducto.addCell(new Paragraph("Cantidad", FontFactory.getFont("Arial", 12))); pTablaProducto.addCell(new Paragraph("Precio", FontFactory.getFont("Arial", 12))); pTablaProducto.addCell(new Paragraph("Total", FontFactory.getFont("Arial", 12))); ArrayList<Venta> listaProductos = ctrlVenta.listByCliente(Integer.parseInt(txtID.getText())); for (Venta v : listaProductos) { Producto prod = ctrlProducto.buscarPorID(v.getProducto().getIdProducto()); pTablaProducto.addCell(new Paragraph(prod.getNombreProducto(), FontFactory.getFont("Arial", 10))); pTablaProducto.addCell( new Paragraph(String.valueOf(v.getCantidadVenta()), FontFactory.getFont("Arial", 10))); pTablaProducto.addCell(new Paragraph("$" + String.valueOf(prod.getPrecioProducto()), FontFactory.getFont("Arial", 10))); pTablaProducto.addCell( new Paragraph("$" + String.valueOf(v.getMontoVenta()), FontFactory.getFont("Arial", 10))); } document.add(pTablaProducto); Paragraph pTotalCompra = new Paragraph("Total Compras: " + txtTotalCompras.getText(), FontFactory.getFont("Arial", 12, Font.BOLD, BaseColor.BLACK)); pTotalCompra.setAlignment(Element.ALIGN_RIGHT); document.add(pTotalCompra); document.add(new Paragraph("\n")); Paragraph pAbonos = new Paragraph("Abonos: ", FontFactory.getFont("Arial", 14, Font.BOLD, BaseColor.BLACK)); pAbonos.setAlignment(Element.ALIGN_CENTER); document.add(pAbonos); document.add(new Paragraph("\n")); PdfPTable tablaAbonos = new PdfPTable(3); float[] mediaCeldasAbonos = { 3.30f, 3.50f, 3.50f }; tablaAbonos.setWidths(mediaCeldasAbonos); tablaAbonos.addCell(new Paragraph("Fecha", FontFactory.getFont("Arial", 12))); tablaAbonos.addCell(new Paragraph("Monto", FontFactory.getFont("Arial", 12))); tablaAbonos.addCell(new Paragraph("Saldo", FontFactory.getFont("Arial", 12))); ArrayList<Abono> listaAbonos = ctrlAbono.listByCliente(txtID.getText()); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); if (listaAbonos.size() > 0) { for (Abono a : listaAbonos) { tablaAbonos.addCell( new Paragraph(sdf.format(a.getFechaAbono()), FontFactory.getFont("Arial", 10))); tablaAbonos.addCell(new Paragraph("$" + String.valueOf(a.getMontoAbono()), FontFactory.getFont("Arial", 10))); tablaAbonos.addCell(new Paragraph("$" + String.valueOf(a.getSaldoAbono()), FontFactory.getFont("Arial", 10))); } } document.add(tablaAbonos); document.close(); file.close(); } catch (FileNotFoundException ex) { Logger.getLogger(Clientes.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(Clientes.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Clientes.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(Clientes.class.getName()).log(Level.SEVERE, null, ex); } try { File file = new File("C:\\CuotaSoft\\Historial.pdf"); Desktop.getDesktop().open(file); } catch (Exception e) { e.printStackTrace(); } }
From source file:Visao.grafico.GraficoRelatorioEstoque.java
private void GerarPDF() throws DocumentException, FileNotFoundException { try {//from w ww .j av a 2 s .c o m int linha = jTableRelatorioGrafico.getSelectedRow(); Document document = new Document(PageSize.A4, 10, 10, 10, 10); //System.out.println(new File(".").getAbsolutePath()); String arquivo = new File("RelatorioFaz.").getAbsolutePath() + "pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo)); document.open(); Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString(); String titulo = "Relatorio"; Paragraph pgt = new Paragraph(titulo, font); pgt.setAlignment(Element.ALIGN_CENTER); document.add(pgt); document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(colunas.length); // Definindo uma fonte, com tamanho 20 e negrito PdfPCell header = new PdfPCell(new Paragraph(titulo, font)); header.setColspan(colunas.length); table.addCell(header); table.setWidthPercentage(100.0f); table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //System.out.println("Tamanho: "+linhas.size()); font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL); for (String coluna : colunas) { table.addCell(new Paragraph(coluna, font)); } //varias linhas for (int i = 0; i < linhas.size(); i++) {//linha for (int j = 0; j < colunas.length; j++) {//coluna table.addCell(new Paragraph(jTableRelatorioGrafico.getValueAt(i, j).toString(), font)); } } document.add(table); document.add(new Paragraph(" ")); font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); document.add(new Paragraph("Dados Totais", font)); font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL); document.close(); JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!"); } catch (FileNotFoundException | DocumentException | HeadlessException ex) { Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null, "Erro ao gerar pdf: " + ex); JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex); } }
From source file:Visao.relatorios.GerarRelatorioCarvao.java
private void GerarPDF() throws DocumentException, FileNotFoundException { try {//from w w w . j a v a2s. c om int linha = jTableRelatorioCarvao.getSelectedRow(); Document document = new Document(PageSize.A4, 10, 10, 10, 10); //System.out.println(new File(".").getAbsolutePath()); String arquivo = new File("Relatorio Carvo Praa.").getAbsolutePath() + "pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo)); document.open(); Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString(); String titulo = "Relatorio Carvo Praa"; Paragraph pgt = new Paragraph(titulo, font); pgt.setAlignment(Element.ALIGN_CENTER); document.add(pgt); document.add(new Paragraph(" ")); /*if(!filtro_matgen.equals("")){ titulo = "Material genetico "+filtro_matgen; }*/ PdfPTable table = new PdfPTable(colunas.length); // Definindo uma fonte, com tamanho 20 e negrito PdfPCell header = new PdfPCell(new Paragraph(titulo, font)); header.setColspan(colunas.length); table.addCell(header); table.setWidthPercentage(100.0f); table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //System.out.println("Tamanho: "+linhas.size()); font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL); for (String coluna : colunas) { table.addCell(new Paragraph(coluna, font)); } //varias linhas for (int i = 0; i < linhas.size(); i++) {//linha for (int j = 0; j < colunas.length; j++) {//coluna //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString()); table.addCell(new Paragraph(jTableRelatorioCarvao.getValueAt(i, j).toString(), font)); } } document.add(table); document.add(new Paragraph(" ")); font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); document.add(new Paragraph("Dados Totais", font)); font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL); document.add(new Paragraph(jLabelInfo1.getText(), font)); document.add(new Paragraph(jLabelVolumeMadeiraTotal.getText(), font)); document.add(new Paragraph(jLabelVolumeCarvaoTotal.getText(), font)); document.close(); JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!"); } catch (FileNotFoundException | DocumentException | HeadlessException ex) { Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null, "Erro ao gerar pdf: " + ex); JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex); } }
From source file:Visao.relatorios.GerarRelatorioCarvaoExpedido.java
private void GerarPDF() throws DocumentException, FileNotFoundException { try {// w w w . j ava 2 s . c o m int linha = jTableExpedirCarvao.getSelectedRow(); Document document = new Document(PageSize.A4, 10, 10, 10, 10); //System.out.println(new File(".").getAbsolutePath()); String arquivo = new File("Relatorio Carvo Expedido.").getAbsolutePath() + "pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo)); document.open(); Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString(); String titulo = "Relatorio Carvo Expedido"; Paragraph pgt = new Paragraph(titulo, font); pgt.setAlignment(Element.ALIGN_CENTER); document.add(pgt); document.add(new Paragraph(" ")); /*if(!filtro_matgen.equals("")){ titulo = "Material genetico "+filtro_matgen; }*/ PdfPTable table = new PdfPTable(colunas.length); // Definindo uma fonte, com tamanho 20 e negrito PdfPCell header = new PdfPCell(new Paragraph(titulo, font)); header.setColspan(colunas.length); table.addCell(header); table.setWidthPercentage(100.0f); table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //System.out.println("Tamanho: "+linhas.size()); font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL); for (String coluna : colunas) { table.addCell(new Paragraph(coluna, font)); } //varias linhas for (int i = 0; i < linhas.size(); i++) {//linha for (int j = 0; j < colunas.length; j++) {//coluna //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString()); table.addCell(new Paragraph(jTableExpedirCarvao.getValueAt(i, j).toString(), font)); } } document.add(table); document.add(new Paragraph(" ")); font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); document.add(new Paragraph("Dados Totais", font)); font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL); document.add(new Paragraph(jLabelInfo1.getText(), font)); document.add(new Paragraph(jLabelPesoTotal.getText(), font)); document.add(new Paragraph(jLabelVolumeTotal.getText(), font)); document.close(); JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!"); } catch (FileNotFoundException | DocumentException | HeadlessException ex) { Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null, "Erro ao gerar pdf: " + ex); JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex); } }
From source file:Visao.relatorios.GerarRelatorioEstoqueBasico.java
private void GerarPDF() throws DocumentException, FileNotFoundException { try {/* w w w . j ava2s .c om*/ /*if(jTableRelatorioEstoquePrincipal.getSelectedRow()>=0) { int linha = jTableRelatorioEstoquePrincipal.getSelectedRow(); Document document = new Document(PageSize.A4, 10, 10, 10, 10); //System.out.println(new File(".").getAbsolutePath()); String arquivo = new File("RelatorioFaz.").getAbsolutePath()+"pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo)); document.open(); Font font = new Font(FontFamily.TIMES_ROMAN, 12, Font.BOLD); //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString(); String titulo = ""; if(!filtro_matgen.equals("")){ titulo = "do material genetico "+filtro_matgen; } Paragraph pgt = new Paragraph("Relatorio "+titulo, font); pgt.setAlignment(Element.ALIGN_CENTER); document.add(pgt); document.add(new Paragraph(" ")); //System.out.println("Colunas "+colunas.length); //for(int i=4; i<colunas.length; i++){ //document.add(new Paragraph(colunas[i]+": "+jTableRelatorioEstoquePrincipal.getValueAt(linha, i).toString())); //} //document.add(new Paragraph("Municipio: "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString())); PdfPTable table = new PdfPTable(colunas.length); // Definindo uma fonte, com tamanho 20 e negrito PdfPCell header = new PdfPCell(new Paragraph("Relatorio "+titulo,font)); header.setColspan(colunas.length); table.addCell(header); table.setWidthPercentage(100.0f); table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //System.out.println("Tamanho: "+linhas.size()); font = new Font(FontFamily.TIMES_ROMAN, 4, Font.NORMAL); for (String coluna : colunas) { table.addCell(new Paragraph(coluna,font)); } //Linha selecionada //for(int j=0;j<colunas.length;j++){//coluna //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(linha, j).toString()); //table.addCell(new Paragraph(jTableRelatorioEstoquePrincipal.getValueAt(linha, j).toString(),font)); //} //varias linhas for(int i=0;i<linhas.size();i++){//linha for(int j=0;j<colunas.length;j++){//coluna //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString()); table.addCell(new Paragraph(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString(),font)); } } document.add(table); document.add(new Paragraph("Relatorio Geral")); document.add(new Paragraph(" ")); document.add(new Paragraph(jLabelAreaTotal.getText())); document.add(new Paragraph(jLabelM3_ha.getText())); document.add(new Paragraph(jLabelMDC_ha.getText())); document.add(new Paragraph(jLabelVolumeMadeiraEstTotal.getText())); document.add(new Paragraph(jLabelVolumeMadeiraTranspTotal.getText())); document.add(new Paragraph(jLabelVolumeCarvaoEstTotal.getText())); document.add(new Paragraph(jLabelVolumeCarvaoTranspTotal.getText())); document.add(new Paragraph(jLabelToneladaMadeiraEstTotal.getText())); document.add(new Paragraph(jLabelToneladaMadeiraTranspTotal.getText())); document.add(new Paragraph(jLabelToneladaCarvaoEstTotal.getText())); document.add(new Paragraph(jLabelToneladaCarvaoTranspTotal.getText())); document.close(); JOptionPane.showMessageDialog(null, "PDF: "+arquivo+" gerado!"); }else { //Document document = new Document(PageSize.A4, 72, 72, 72, 72); Rectangle rect = new Rectangle(1200, 595); Document document = new Document(rect); String arquivo = new File("RelatorioGeral.").getAbsolutePath()+"pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo)); document.open(); document.add(new Paragraph("Relatorio Geral")); document.add(new Paragraph(" ")); document.add(new Paragraph(jLabelAreaTotal.getText())); document.add(new Paragraph(jLabelM3_ha.getText())); document.add(new Paragraph(jLabelMDC_ha.getText())); document.add(new Paragraph(jLabelVolumeMadeiraEstTotal.getText())); document.add(new Paragraph(jLabelVolumeMadeiraTranspTotal.getText())); document.add(new Paragraph(jLabelVolumeCarvaoEstTotal.getText())); document.add(new Paragraph(jLabelVolumeCarvaoTranspTotal.getText())); document.add(new Paragraph(jLabelToneladaMadeiraEstTotal.getText())); document.add(new Paragraph(jLabelToneladaMadeiraTranspTotal.getText())); document.add(new Paragraph(jLabelToneladaCarvaoEstTotal.getText())); document.add(new Paragraph(jLabelToneladaCarvaoTranspTotal.getText())); document.close(); JOptionPane.showMessageDialog(null, "PDF: "+arquivo+" gerado!"); }*/ int linha = jTableRelatorioEstoquePrincipal.getSelectedRow(); Document document = new Document(PageSize.A4, 10, 10, 10, 10); //System.out.println(new File(".").getAbsolutePath()); String arquivo = new File("RelatorioFaz.").getAbsolutePath() + "pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo)); document.open(); Font font = new Font(FontFamily.TIMES_ROMAN, 12, Font.BOLD); //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString(); String titulo = "Relatorio"; Paragraph pgt = new Paragraph(titulo, font); pgt.setAlignment(Element.ALIGN_CENTER); document.add(pgt); document.add(new Paragraph(" ")); if (!filtro_matgen.equals("")) { titulo = "Material genetico " + filtro_matgen; } PdfPTable table = new PdfPTable(colunas.length); // Definindo uma fonte, com tamanho 20 e negrito PdfPCell header = new PdfPCell(new Paragraph(titulo, font)); header.setColspan(colunas.length); table.addCell(header); table.setWidthPercentage(100.0f); table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //System.out.println("Tamanho: "+linhas.size()); font = new Font(FontFamily.TIMES_ROMAN, 4, Font.NORMAL); for (String coluna : colunas) { table.addCell(new Paragraph(coluna, font)); } //varias linhas for (int i = 0; i < linhas.size(); i++) {//linha for (int j = 0; j < colunas.length; j++) {//coluna //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString()); table.addCell(new Paragraph(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString(), font)); } } document.add(table); document.add(new Paragraph(" ")); font = new Font(FontFamily.TIMES_ROMAN, 12, Font.BOLD); document.add(new Paragraph("Dados Totais", font)); font = new Font(FontFamily.TIMES_ROMAN, 8, Font.NORMAL); document.add(new Paragraph(jLabelInfo1.getText(), font)); document.add(new Paragraph(jLabelAreaTotal.getText(), font)); document.add(new Paragraph(jLabelM3_ha.getText(), font)); document.add(new Paragraph(jLabelMDC_ha.getText(), font)); document.add(new Paragraph(jLabelTotalMadeiraPraca.getText(), font)); document.add(new Paragraph(jLabelTotalCarvaoPraca.getText(), font)); document.add(new Paragraph(jLabelInfo2.getText(), font)); document.add(new Paragraph(jLabelVolumeMadeiraEstTotal.getText(), font)); document.add(new Paragraph(jLabelVolumeMadeiraTranspTotal.getText(), font)); document.add(new Paragraph(jLabelToneladaMadeiraEstTotal.getText(), font)); document.add(new Paragraph(jLabelToneladaMadeiraTranspTotal.getText(), font)); document.add(new Paragraph(jLabelInfo3.getText(), font)); document.add(new Paragraph(jLabelVolumeCarvaoEstTotal.getText(), font)); document.add(new Paragraph(jLabelVolumeCarvaoProdTotal.getText(), font)); document.add(new Paragraph(jLabelVolumeCarvaoTranspTotal.getText(), font)); document.add(new Paragraph(jLabelToneladaCarvaoEstTotal.getText(), font)); document.add(new Paragraph(jLabelToneladaCarvaoProdTotal.getText(), font)); document.add(new Paragraph(jLabelToneladaCarvaoTranspTotal.getText(), font)); document.close(); JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!"); } catch (FileNotFoundException | DocumentException | HeadlessException ex) { Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null, "Erro ao gerar pdf: " + ex); JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex); } }
From source file:Visao.relatorios.GerarRelatorioForno.java
private void GerarPDF() throws DocumentException, FileNotFoundException { try {// ww w. ja v a 2 s. c om int linha = jTableForno.getSelectedRow(); Document document = new Document(PageSize.A4, 10, 10, 10, 10); //System.out.println(new File(".").getAbsolutePath()); String arquivo = new File("Relatorio Carvo Expedido.").getAbsolutePath() + "pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo)); document.open(); Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString(); String titulo = "Relatorio Carvo Expedido"; Paragraph pgt = new Paragraph(titulo, font); pgt.setAlignment(Element.ALIGN_CENTER); document.add(pgt); document.add(new Paragraph(" ")); /*if(!filtro_matgen.equals("")){ titulo = "Material genetico "+filtro_matgen; }*/ PdfPTable table = new PdfPTable(colunas.length); // Definindo uma fonte, com tamanho 20 e negrito PdfPCell header = new PdfPCell(new Paragraph(titulo, font)); header.setColspan(colunas.length); table.addCell(header); table.setWidthPercentage(100.0f); table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //System.out.println("Tamanho: "+linhas.size()); font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL); for (String coluna : colunas) { table.addCell(new Paragraph(coluna, font)); } //varias linhas for (int i = 0; i < linhas.size(); i++) {//linha for (int j = 0; j < colunas.length; j++) {//coluna //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString()); table.addCell(new Paragraph(jTableForno.getValueAt(i, j).toString(), font)); } } document.add(table); document.add(new Paragraph(" ")); font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); document.add(new Paragraph("Dados Totais", font)); font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL); document.add(new Paragraph(jLabelInfo1.getText(), font)); document.add(new Paragraph(jLabelFornosCheios.getText(), font)); document.add(new Paragraph(jLabelFornosVazios.getText(), font)); document.add(new Paragraph(jLabelFornosCarbonizando.getText(), font)); document.add(new Paragraph(jLabelFornosResfriando.getText(), font)); document.add(new Paragraph(jLabelFornosReforma.getText(), font)); document.add(new Paragraph(jLabelFornosManutencao.getText(), font)); document.close(); JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!"); } catch (FileNotFoundException | DocumentException | HeadlessException ex) { Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null, "Erro ao gerar pdf: " + ex); JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex); } }
From source file:Visao.relatorios.GerarRelatorioMadeiraPraca.java
private void GerarPDF() throws DocumentException, FileNotFoundException { try {/* ww w. jav a2 s. co m*/ int linha = jTableMadeiraEstoquePraca.getSelectedRow(); Document document = new Document(PageSize.A4, 10, 10, 10, 10); //System.out.println(new File(".").getAbsolutePath()); String arquivo = new File("Relatorio Madeira Praa.").getAbsolutePath() + "pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo)); document.open(); Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString(); String titulo = "Relatorio Madeira Praa"; Paragraph pgt = new Paragraph(titulo, font); pgt.setAlignment(Element.ALIGN_CENTER); document.add(pgt); document.add(new Paragraph(" ")); /*if(!filtro_matgen.equals("")){ titulo = "Material genetico "+filtro_matgen; }*/ PdfPTable table = new PdfPTable(colunas.length); // Definindo uma fonte, com tamanho 20 e negrito PdfPCell header = new PdfPCell(new Paragraph(titulo, font)); header.setColspan(colunas.length); table.addCell(header); table.setWidthPercentage(100.0f); table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //System.out.println("Tamanho: "+linhas.size()); font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL); for (String coluna : colunas) { table.addCell(new Paragraph(coluna, font)); } //varias linhas for (int i = 0; i < linhas.size(); i++) {//linha for (int j = 0; j < colunas.length; j++) {//coluna //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString()); table.addCell(new Paragraph(jTableMadeiraEstoquePraca.getValueAt(i, j).toString(), font)); } } document.add(table); document.add(new Paragraph(" ")); font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); document.add(new Paragraph("Dados Totais", font)); font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL); document.add(new Paragraph(jLabelInfo1.getText(), font)); document.add(new Paragraph(jLabelMStereoTotal.getText(), font)); document.add(new Paragraph(jLabelM3Total.getText(), font)); document.add(new Paragraph(jLabelPesoTotal.getText(), font)); document.close(); JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!"); } catch (FileNotFoundException | DocumentException | HeadlessException ex) { Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null, "Erro ao gerar pdf: " + ex); JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex); } }