2
votes

I need to send to the client a byte[] with a pdf data from my tomcat server. I'm using this:

response.setContentType("application/pdf");
response.setHeader("Content-Disposition:","inline; filename=test.pdf");

But (at least) with firefox I get a file download instead of inline display. The only way to show pdf data inline is to remove the Content-Disposition header record however, if I do so I cannot set the filename, the pdf name is get from the last folder of url.

1
Did you finally found a solution? If so, please add it below as an answer - will give +1 for sure, thanks. (even a solution that works with IE only would be preferable to nothing)outofmind

1 Answers

1
votes

You seems to be setting the right headers. But rendering of pdf or another such formats depends on the browser capabilities as well. I mean browser need to have a pdf plugin installed in order to render a pdf when it sees the same in the contentType header field. So make sure you install a pdf plugin for your firefox and try to test after that. You can download firefox pdf plugin from here:

https://addons.mozilla.org/en-US/firefox/addon/pdf-download/