List of usage examples for com.itextpdf.text.html.simpleparser HTMLWorker HTMLWorker
public HTMLWorker(final DocListener document)
From source file:Modelo.RelatoriosBEAN.java
public static void relatorioMontanteVendedor() throws FileNotFoundException, DocumentException { String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf"; Document document = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(document, new FileOutputStream(path)); document.open();//from w w w . ja v a 2 s. c o m document.addAuthor("TechSales"); document.addCreator("TechSales"); document.addSubject("TechSales - Sistema de gerenciamento de locadoras"); document.addCreationDate(); document.addTitle("TechSales"); HTMLWorker htmlWorker = new HTMLWorker(document); String frase; try { frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<br/>" + "<h1 align=center>Relatrio de montante por vendedor</h1>" + "<br/><br/>" + "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<tr> " + "<th align=center><strong>Cdigo do funcionario</strong></th> " + "<th align=center><strong>Nome do funcionario</strong></th> " + "<th align=center><strong>Nmero de vendas</strong></th> " + "<th align=center><strong>Valor total das vendas</strong></th> " + "<th align=center><strong>Quantidade de alugueis</strong></th> " + "<th align=center><strong>Valor total de alugueis</strong></th> " + "<th align=center><strong>Montante Total</strong></th> " + "</tr> "; for (MontanteBEAN j : jDAO.montanteVendedor()) { frase += "<tr align=center><td>" + j.getFunCodigo() + "</td><td>" + j.getFunNome() + "</td><td>" + j.getnVendas() + "</td><td>" + j.getValorVendas() + "</td><td>" + j.getnAluguel() + "</td><td>" + j.getValorAluguel() + "</td><td>" + j.getValorTotal() + "</td></tr>"; } frase += "</table>"; frase += "</body></html>"; htmlWorker.parse(new StringReader(frase)); document.close(); if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().open(new File(path)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Modelo.RelatoriosBEAN.java
public static void relatorioVendaJogoPeriodo(String s, String dI, String dF) throws FileNotFoundException, DocumentException { String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf"; Document document = new Document(PageSize.LETTER); PdfWriter.getInstance(document, new FileOutputStream(path)); document.open();//w ww .ja v a 2s .c om document.addAuthor("TechSales"); document.addCreator("TechSales"); document.addSubject("TechSales - Sistema de gerenciamento de locadoras"); document.addCreationDate(); document.addTitle("TechSales"); HTMLWorker htmlWorker = new HTMLWorker(document); String frase; try { frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<h1 align=center>Relatrio de Jogos vendidos</h1>" + "<br/>" + "<h3 align=center>Perodo de " + dI + " a " + dF + "</h3>" + "<br/><br/>" + "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<tr> " + "<th align=center><strong>Cdigo do jogo</strong></th> " + "<th align=center><strong>Nome do jogo</strong></th> " + "<th align=center><strong>Nmero de vendas</strong></th> " + "<th align=center><strong>Valor total das vendas</strong></th> " + "</tr> "; for (JogoBEAN j : jDAO.vendaPorPeriodo(s)) { frase += "<tr align=center><td>" + j.getJoCodigo() + "</td><td>" + j.getJoNome() + "</td><td>" + j.getJoQtd() + "</td><td>" + j.getJoPrecoPadrao() + "</td></tr>"; } frase += "</table>"; frase += "</body></html>"; htmlWorker.parse(new StringReader(frase)); document.close(); if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().open(new File(path)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Modelo.RelatoriosBEAN.java
public static void relatorioAluguelJogoPeriodo(String s, String dI, String dF) throws FileNotFoundException, DocumentException { String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf"; Document document = new Document(PageSize.LETTER); PdfWriter.getInstance(document, new FileOutputStream(path)); document.open();/*from w w w. ja v a 2s. co m*/ document.addAuthor("TechSales"); document.addCreator("TechSales"); document.addSubject("TechSales - Sistema de gerenciamento de locadoras"); document.addCreationDate(); document.addTitle("TechSales"); HTMLWorker htmlWorker = new HTMLWorker(document); String frase; try { frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<br/>" + "<h1 align=center>Relatrio de Jogos alugados</h1>" + "<h3 align=center>Perodo de " + dI + " a " + dF + "</h3>" + "<br/><br/>" + "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<tr> " + "<th align=center><strong>Cdigo do jogo</strong></th> " + "<th align=center><strong>Nome do jogo</strong></th> " + "<th align=center><strong>Nmero de alugueis</strong></th> " + "<th align=center><strong>Valor total dos alugueis</strong></th> " + "</tr> "; for (JogoBEAN j : jDAO.aluguelPorPeriodo(s)) { frase += "<tr align=center><td>" + j.getJoCodigo() + "</td><td>" + j.getJoNome() + "</td><td>" + j.getJoQtd() + "</td><td>" + j.getJoPrecoPadrao() + "</td></tr>"; } frase += "</table>"; frase += "</body></html>"; htmlWorker.parse(new StringReader(frase)); document.close(); if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().open(new File(path)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Modelo.RelatoriosBEAN.java
public static void relatorioMontanteCliente() throws FileNotFoundException, DocumentException { String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf"; Document document = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(document, new FileOutputStream(path)); document.open();//from ww w. j a v a 2s.c o m document.addAuthor("TechSales"); document.addCreator("TechSales"); document.addSubject("TechSales - Sistema de gerenciamento de locadoras"); document.addCreationDate(); document.addTitle("TechSales"); HTMLWorker htmlWorker = new HTMLWorker(document); String frase; try { frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<br/>" + "<h1 align=center>Relatrio de montante por cliente </h1>" + "<br/><br/>" + "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<tr> " + "<th align=center><strong>Cdigo do cliente</strong></th> " + "<th align=center><strong>Nome do cliente</strong></th> " + "<th align=center><strong>Nmero de compras</strong></th> " + "<th align=center><strong>Valor total das compras</strong></th> " + "<th align=center><strong>Quantidade de alugueis</strong></th> " + "<th align=center><strong>Valor total de alugueis</strong></th> " + "<th align=center><strong>Montante Total</strong></th> " + "</tr> "; for (MontanteBEAN j : jDAO.montanteCliente()) { frase += "<tr align=center><td>" + j.getFunCodigo() + "</td><td>" + j.getFunNome() + "</td><td>" + j.getnVendas() + "</td><td>" + j.getValorVendas() + "</td><td>" + j.getnAluguel() + "</td><td>" + j.getValorAluguel() + "</td><td>" + j.getValorTotal() + "</td></tr>"; } frase += "</table>"; frase += "</body></html>"; htmlWorker.parse(new StringReader(frase)); document.close(); if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().open(new File(path)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Modelo.RelatoriosBEAN.java
public static void notaDaVenda(VendaBEAN v) throws FileNotFoundException, DocumentException { String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf"; Document document = new Document(PageSize.LETTER); PdfWriter.getInstance(document, new FileOutputStream(path)); document.open();/* ww w . j a va 2 s.c om*/ document.addAuthor("TechSales"); document.addCreator("TechSales"); document.addSubject("TechSales - Sistema de gerenciamento de locadoras"); document.addCreationDate(); document.addTitle("TechSales"); HTMLWorker htmlWorker = new HTMLWorker(document); String frase; try { frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<h1 align=center>Nota de Compra</h1>" + "<br/><br/>" + "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<tr> " + "<th align=center><strong>Cdigo</strong></th> " + "<th align=center><strong>Cliente</strong></th> " + "<th align=center><strong>Data</strong></th> " + "<th align=center><strong>Total</strong></th> " + "<th align=center><strong>Entrada</strong></th> " + "<th align=center><strong>Parcelas</strong></th> " + "<th align=center><strong>Vendedor</strong></th> " + "</tr> "; frase += "<tr align=center><td>" + v.getVendaCodigo() + "</td><td>" + v.getCliente().getCliCodigo() + "</td><td>" + v.getVendaData() + "</td><td>" + "</td><td>" + v.getVendaValorTotal() + "</td><td>" + "</td><td>" + v.getVendaEntrada() + "</td><td>" + "</td><td>" + v.getVendaNparcelas() + "</td><td>" + "</td><td>" + v.getVendedor().getVendedorCodigo() + "</td></tr>" + "</table>"; frase += "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<br/><br/>" + "<tr> " + "<th align=center><strong>Parcela</strong></th> " + "<th align=center><strong>Data</strong></th> " + "<th align=center><strong>Valor</strong></th> " + "<th align=center><strong>Situao</strong></th> " + "</tr> "; for (VendaAPrazoBEAN vap : cVap.listarALL()) { if (vap.getVenda().getVendaCodigo() == v.getVendaCodigo()) { frase += "<tr align=center><td>" + vap.getVapNumParcela() + "</td><td>" + vap.getVapData() + "</td><td>" + vap.getVapValorParcela() + "</td><td>" + vap.getVapSituacao() + "</td></tr>"; } } frase += "</table>"; frase += "</body></html>"; htmlWorker.parse(new StringReader(frase)); document.close(); if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().open(new File(path)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Modelo.RelatoriosBEAN.java
public static void notaDaDev(DevolucaoBEAN l) throws FileNotFoundException, DocumentException { String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf"; Document document = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(document, new FileOutputStream(path)); document.open();//from ww w. j a v a2 s . co m document.addAuthor("TechSales"); document.addCreator("TechSales"); document.addSubject("TechSales - Sistema de gerenciamento de locadoras"); document.addCreationDate(); document.addTitle("TechSales"); HTMLWorker htmlWorker = new HTMLWorker(document); String frase; try { frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<h1 align=center>Nota de devoluo</h1>" + "<br/><br/>" + "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<tr> " + "<th align=center><strong>Cdigo</strong></th> " + "<th align=center><strong>Cliente</strong></th> " + "<th align=center><strong>Data Devoluo</strong></th> " + "<th align=center><strong>Multa</strong></th> " + "<th align=center><strong>Valor Total</strong></th> " + "<th align=center><strong>Vendedor</strong></th> " + "</tr> "; frase += "<tr align=center><td>" + l.getDevCodigo() + "</td><td>" + l.getLocacao().getCliente().getCliNome() + "</td><td>" + l.getDevData() + "</td><td>" + l.getDevMulta() + "</td><td>" + l.getDevValor() + "</td><td>" + l.getLocacao().getVendedor().getFuncionario().getFunNome() + "</td></tr>" + "</table>"; frase += "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<br/><br/>" + "<tr> " + "<th align=center><strong>Cdigo do Jogo</strong></th> " + "<th align=center><strong>Nome</strong></th> " + "<th align=center><strong>Quantidade Locao</strong></th> " + "</tr> "; for (JogoLocacaoBEAN jl : cJl.listarALL()) { if (jl.getChaveComposta().getLocacao().getLocCodigo() == l.getLocacao().getLocCodigo()) { frase += "<tr align=center><td>" + jl.getChaveComposta().getJogo().getJoCodigo() + "</td><td>" + jl.getChaveComposta().getJogo().getJoNome() + "</td><td>" + jl.getJlQtd() + "</td></tr>"; } } frase += "</table>"; frase += "</body></html>"; htmlWorker.parse(new StringReader(frase)); document.close(); if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().open(new File(path)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Modelo.RelatoriosBEAN.java
public static void notaDeConta(ContaBEAN v) throws FileNotFoundException, DocumentException { String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf"; Document document = new Document(PageSize.LETTER); PdfWriter.getInstance(document, new FileOutputStream(path)); document.open();//from www.j a v a 2 s . c o m document.addAuthor("TechSales"); document.addCreator("TechSales"); document.addSubject("TechSales - Sistema de gerenciamento de locadoras"); document.addCreationDate(); document.addTitle("TechSales"); HTMLWorker htmlWorker = new HTMLWorker(document); String frase; try { frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<h1 align=center>Nota de Conta</h1>" + "<br/><br/>" + "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<tr> " + "<th align=center><strong>Cdigo</strong></th> " + "<th align=center><strong>Fornecedor</strong></th> " + "<th align=center><strong>Data</strong></th> " + "<th align=center><strong>Total</strong></th> " + "<th align=center><strong>Entrada</strong></th> " + "<th align=center><strong>Parcelas</strong></th> " + "</tr> "; frase += "<tr align=center><td>" + v.getConCodigo() + "</td><td>" + v.getFornecedor().getForNomeEmpresa() + "</td><td>" + v.getConData() + "</td><td>" + v.getConValorTotal() + "</td><td>" + v.getConEntrada() + "</td><td>" + v.getConNparcelas() + "</td></tr>" + "</table>"; frase += "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<br/><br/>" + "<tr> " + "<th align=center><strong>Parcela</strong></th> " + "<th align=center><strong>Data</strong></th> " + "<th align=center><strong>Valor</strong></th> " + "<th align=center><strong>Situao</strong></th> " + "</tr> "; for (ContaAPrazoBEAN vap : cCap.listarALL()) { if (vap.getConta().getConCodigo() == v.getConCodigo()) { frase += "<tr align=center><td>" + vap.getCapNumParcela() + "</td><td>" + vap.getCapData() + "</td><td>" + vap.getCapValorParcela() + "</td><td>" + vap.getCapSituacao() + "</td></tr>"; } } frase += "</table>"; frase += "</body></html>"; htmlWorker.parse(new StringReader(frase)); document.close(); if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().open(new File(path)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Modelo.RelatoriosBEAN.java
public static void notaDeCompra(NotaDecompraBEAN n) throws FileNotFoundException, DocumentException { String path = System.getProperty("user.home") + FRMEmitirRelatorios.local + ".pdf"; Document document = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(document, new FileOutputStream(path)); document.open();/*from www .jav a2s .co m*/ document.addAuthor("TechSales"); document.addCreator("TechSales"); document.addSubject("TechSales - Sistema de gerenciamento de locadoras"); document.addCreationDate(); document.addTitle("TechSales"); HTMLWorker htmlWorker = new HTMLWorker(document); String frase; try { frase = "<html>" + "<head> <meta charset=\"utf-8\"> </head>" + "<body>" + "<br/>" + "<h1 align=center>Relatrio de Jogos Comprados </h1>" + "<br/><br/>" + "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<tr> " + "<th align=center><strong>Cdigo</strong></th> " + "<th align=center><strong>Custo Unitrio</strong></th> " + "<th align=center><strong>Data</strong></th> " + "<th align=center><strong>Valor da Entrada</strong></th> " + "<th align=center><strong>Nmero de parcelas</strong></th> " + "<th align=center><strong>Preo Total</strong></th> " + "<th align=center><strong>Quantidade Compradra</strong></th> " + "<th align=center><strong>Caixa</strong></th> " + "<th align=center><strong>Jogo</strong></th> " + "</tr> "; frase += "<tr align=center><td>" + n.getNdcCodigo() + "</td><td>" + n.getNdcCustoUnitario() + "</td><td>" + n.getNdcData() + "</td><td>" + n.getNdcEntrada() + "</td><td>" + n.getNdcParcelas() + "</td><td>" + n.getNdcPrecoTotal() + "</td><td>" + n.getNdcQtdComprada() + "</td><td>" + n.getCaixa().getCaixaCodigo() + "</td><td>" + n.getJogo().getJoNome() + "</td></tr>" + "</table>"; ; frase += "<table BORDER RULES=rows border=0 style=\" width:100%; \">\n" + "<br/><br/>" + "<tr> " + "<th align=center><strong>Parcela</strong></th> " + "<th align=center><strong>Data</strong></th> " + "<th align=center><strong>Valor</strong></th> " + "<th align=center><strong>Situao</strong></th> " + "</tr> "; for (NotaDeCompraPrazoBEAN nap : cNdcap.listarALL()) { if (nap.getNota().getNdcCodigo() == n.getNdcCodigo()) { frase += "<tr align=center><td>" + nap.getNapNumParcela() + "</td><td>" + nap.getNapData() + "</td><td>" + nap.getNapValor() + "</td><td>" + nap.getNapSituacao() + "</td></tr>"; } } frase += "</table>"; frase += "</body></html>"; htmlWorker.parse(new StringReader(frase)); document.close(); if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().open(new File(path)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:models.FirstPdf.java
public static String writePdfFromHtml(String html, String fileName) { try {//from ww w . ja va 2s . co m String k = html; FileOutputStream file = new FileOutputStream(new File( "C:\\Users\\Paul\\Documents\\workspace-sts-3.7.0.RELEASE\\ifntung\\src\\main\\webapp\\resources\\theme1\\" + fileName + ".pdf")); Document document = new Document(); PdfWriter.getInstance(document, file); document.open(); HTMLWorker htmlWorker = new HTMLWorker(document); htmlWorker.parse(new StringReader(k)); document.close(); file.close(); /*JasperReportBuilder report = DynamicReports.report(); report.show(); //export the report to a pdf file report.toPdf(new FileOutputStream("C:\\Users\\Paul\\Documents\\workspace-sts-3.7.0.RELEASE\\ifntung\\src\\main\\webapp\\resources\\theme1\\test2.pdf")); */ File generatedfile = new File( "C:\\Users\\Paul\\Documents\\workspace-sts-3.7.0.RELEASE\\ifntung\\src\\main\\webapp\\resources\\theme1\\" + fileName + ".pdf"); if (generatedfile.exists()) { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(generatedfile); } else { System.out.println("Not Supported by your desktop"); } } else { System.out.println("File does not Exists"); } } catch (Exception e) { e.printStackTrace(); } return "C:\\Users\\Paul\\Documents\\workspace-sts-3.7.0.RELEASE\\ifntung\\src\\main\\webapp\\resources\\theme1\\" + fileName + ".pdf"; }
From source file:mscb.tick.gui.resoluciones.DetalleProyecto.java
private void escribirArchivo(SmbFileOutputStream archivo, String texto) throws DocumentException, MalformedURLException, IOException { //byte[] array = texto.getBytes(); Document documento = new Document(); PdfWriter.getInstance(documento, archivo); documento.open();/* w w w . java 2s . com*/ HTMLWorker htmlWorker = new HTMLWorker(documento); htmlWorker.parse(new StringReader(texto)); //documento.add(new Paragraph(texto)); documento.close(); }