You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tokajac <im...@hotmail.com> on 2009/06/15 23:08:39 UTC

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Generated PDF download from Tomcat

Posted by Pid <p...@pidster.com>.
Some versions of IE have issues when downloading PDF files under HTTPS
and cache-control headers do affect this.  Google for more info.

I'm not familiar with PD4ML but if you're having concurrent request
issues then you should check you're not doing something in your code
which is causing the problem.

p






attacus wrote:
> 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_tokai@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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Generated PDF download from Tomcat

Posted by attacus <at...@trtk.ru>.
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_tokai@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org