Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class.forName("org.postgresql.Driver");
- Connection conexion = DriverManager.getConnection("jdbc:postgresql://localhost:5432/reportes", usuario, contraseña;
- File reportDir=new File(getServletContext().getRealPath("WEB-INF/repProd.jasper"));
- JasperReport reporte= (JasperReport) JRLoader.loadObject(reportDir);
- JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, null, conexion);
- JRExporter exporter = new JRPdfExporter();
- exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
- exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);//new java.io.File("reportePDF.pdf")
- exporter.exportReport();
- JasperReport reporte= (JasperReport) JRLoader.loadObject(reportDir);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement