Tutorials4u.net Forum
Handle PDF output - Printable Version

+- Tutorials4u.net Forum (http://www.tutorials4u.net/forum)
+-- Forum: Discussion Forum (/forumdisplay.php?fid=1)
+--- Forum: Servlets (/forumdisplay.php?fid=4)
+--- Thread: Handle PDF output (/showthread.php?tid=13)


Handle PDF output - tutorials4u - 12-14-2010 08:44 AM

* Set the content-type of the response to "application/pdf", ex. response.setContentType("application/pdf");
* Add a dummy parameter on the end of the url, like:
http://x.y.z/DoGenCompStmt?filename=dummy.pdf
because IE ignores content-types, so you need to give it a hint, and the ".pdf" extension is an easy way.
* Set the "content-length" on the response, otherwise the Acrobat Reader plugin may not work properly, ex. response.setContentLength(bos.size());
* An additional thing that seems to help some IE browsers is to also have : response.setHeader("Content-Disposition", "inline;filename=somepdf.pdf");