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:[email protected]] Sent: Tuesday, June 16, 2009 1:09 AM To: [email protected] 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: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
