rajesh_mwar1 Posted November 28, 2006 Share Posted November 28, 2006 JasperReport oJasperReport = JasperCompileManager.compileReport(reportSource);JasperPrint oJasperPrint = JasperFillManager.fillReport(oJasperReport, oParms, iConn);JasperExportManager.exportReportToPdfFile(oJasperPrint, reportDest); Hi,the above code is used by me..Where "reportDest" ia a path to store the generated pdf.Upto this Ok.But IFpdf in a "reportDest" is showing the same result for different "Where" Conditions in my query..So wht i want is i dont want the genrated pdf to be put put in a "reportDest" and i directly want pdf to be generated and should be run in my browser... Link to comment Share on other sites More sharing options...
kumarasamymk Posted November 28, 2006 Share Posted November 28, 2006 This may help u....U have execute the query from jsp side or what ever and pass the JRDataSource to So that u can get the dynamic data in the pdf. This code it'll will display the pdf in the browser.File reportFile = new File("Test.jasper");JasperReport jasperReport = JasperReport)JRLoader.loadObject(reportFile.getPath());Map param = (Map)session.getAttribute("param");JasperPrint jasperPrint = (JasperPrint) JasperFillManager.fillReport(jasperReport,param, JRDataSource);JRPdfExporter exporter = new JRPdfExporter(); response.setContentType("application/pdf");ServletOutputStream ouputStream = response.getOutputStream();exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream); exporter.exportReport();ouputStream.flush(); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now