ChristFollower Posted December 8, 2006 Share Posted December 8, 2006 I have a Struts application. The following code is in an Action method which is invoked from a JSP. On the JSP, I use target="_blank" so it brings up a 2nd page displaying the PDF. The problem we have is that it doesn't display the PDF on our PRODUCTION server running SSL. With IE7, if I check the "Do not save encrypted pages to disk" it would fix the problem. However, in IE6, it still doesn't display. FireFox 2.0 works normally. I wonder if anyone has experienced similar problem and can suggest some solutions. Thanks. Danny JasperPrint jasperPrint = JasperFillManager.fillReport(jasperFile, parameters, new JRBeanCollectionDataSource(inmateFactSheetInfo)); jasperPrintList.add(jasperPrint); response.setContentType("application/pdf"); log.debug("Sending report list to PDF exporter..."); JRPdfExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrintList); OutputStream ouputStream = response.getOutputStream(); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream); try { log.debug("Exporting report to PDF..."); exporter.exportReport(); } catch (JRException e) { throw new ServletException(e); } finally { if (ouputStream != null) { try { log.debug("Closing output stream..."); ouputStream.close(); log.debug("Output stream closed..."); } catch (IOException ex) { } } } Link to comment Share on other sites More sharing options...
sforner Posted January 3, 2007 Share Posted January 3, 2007 Hi, we had a similar problem. There is a bug by Microsoft related to this problem: Bug Report .We solved this by manually setting headers of the response, e.g.: Code:String userAgent = request.getHeader("user-agent"«»);if (userAgent != null && userAgent.toUpperCase().indexOf("MSIE"«») > -1) { response.setHeader("Pragma", "public"«»); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"«»); response.setHeader("Content-Transfer-Encoding", "binary"«»);}response.setContentType("application/pdf"«»);response.setHeader("Content-Disposition", "Attachment; filename=Print.pdf"«»); I hope this is useful for you. Greetings Stefan 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