tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Nix" <Jeremy....@sfsltd.com>
Subject Tomcat 5 and returning PDF in response outputstream
Date Fri, 01 Oct 2004 16:50:30 GMT
Has anyone else had trouble rendering PDF's (in Internet Explorer) when
sending the pdf directly into the response outputstream and rendering in
Internet Explorer?  I realize there are a lot of factors at work here,
but I find that my configuration works fine when I switch to Tomcat
4.1.30.  I'm setting the content type and content length on the
response.  The code I use is below:

	pdf = generatePDF();
	response.resetBuffer();
	response.setHeader("Cache-Control", "max-age=30");
	response.setHeader("Content-Disposition", "inline;
filename=generated.pdf; size=" + pdf.getBytes().length);
	response.setContentType("application/pdf");
	response.setContentLength(pdf.getBytes().length);
	response.getOutputStream().write(pdf.getBytes());
	response.flushBuffer();

If I access my url with Netscape, the pdf displays correctly.  If I save
it out to the filesystem (on server side), pdf displays correctly. It's
just something with the configuration of Tomcat 5 and Internet Explorer
that is not working correctly.  The same code posted above works for
both Netscape and IE when run under Tomcat 4.1.30.

Has anyone had similar problems?


_________________________________
Jeremy Nix
Senior Application Developer
Southwest Financial Services, LTD.
(513) 621-6699 x1158
www.sfsltd.com



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


Mime
View raw message