nikitha Posted March 30, 2009 Share Posted March 30, 2009 Hi,I have a requirement , to export the report of pdf type in a separate browser, could anyone help me.Here, the code which i am using:if (format.equalsIgnoreCase("pdf")){new JRPdfExporter();JASPER_PRINT, jprint);OUTPUT_STREAM, pdfReport);contentType = "application/pdf"; fileName = jrFileName + "__" + ".pdf"; The output, which i am getting is right, but it is opening in the Adobe reader window, please help me to open in a browser.Thanks and Regards, Naveen Chanda JRPdfExporter exporter =exporter.setParameter(JRExporterParameter.exporter.setParameter(JRExporterParameter.exporter.exportReport();bytes = pdfReport.toByteArray(); } Link to comment Share on other sites More sharing options...
imran_lk2002 Posted March 31, 2009 Share Posted March 31, 2009 Use this way,JasperPrint jasperPrint = JasperFillManager.fillReport( new FileInputStream(new File(reportFile, reportName + ".jasper")),parameters, connection); byte[] bytes = JasperExportManager.exportReportToPdf(jasperPrint); length); response.getOutputStream().write(bytes); response.setContentType("application/pdf"); JasperPrintManager.printReportToPdf(jasperPrint); servletOutputStream.flush();servletOutputStream.close();Regards.Imran response.setContentLength(bytes. 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