response.setHeader("Pragma", "public"); response.setHeader("Cache-Control", "max-age=0"); response.setContentType("application/octet-stream"); response.setHeader("content-disposition", "attachment; filename=yourfile.pdf");
And don't use window.open(). Just use direct link. -----Original Message----- From: Tokajac [mailto:imre_to...@hotmail.com] Sent: Tuesday, June 16, 2009 1:09 AM To: users@tomcat.apache.org Subject: Generated PDF download from Tomcat Hello, I convert a html page with PD4ML to PDF. After that I want to download it via browser. This is used for download: view plaincopy to clipboardprint? response.setContentType("application/force-download"); response.setHeader("Pragma", "No-cache"); response.setHeader("Content-Disposition", "Attachment;Filename=\"report.pdf\""); response.setHeader("Pragma", "public"); Open/Save/Cancel dialog appears and SOMETIMES I get exceptions like: "File does not begin with '%PDF-" "Corrupted..." These errors appear very often when opening with Internet Explorer; Especially when i send (almost) simultaneous requests from several browsers. Mozilla works a bit better. When I redirect Outputstream to file -i ALWAYS get proper PDF document. How can i always get proper PDF download possibility from Tomcat application? Regards -- View this message in context: http://www.nabble.com/Generated-PDF-download-from-Tomcat-tp24042088p24042088 .html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org