Using the right mix of XSLT, XSL-FO and Apache FOP, I am able to send a PDF into some browser window.
In fact, I am sending the file content as follows:
response.setContentType("application/pdf"); response.setContentLength( out.size()); response.getOutputStream().write( out.toByteArray()); response.getOutputStream().flush();
As expected, the browser shows the PDF content in a tab named "pdf", and if I save the file locally, the name also defaults to pdf.pdf
How can I force the file name?
I tried the following among other things that didn't work:
response.setHeader("Content-Disposition","inline; filename=" + filename + ".pdf" );
For clarity I want to display the content in the browser (as opposed to a straight download)
inline
toattachment
. That should do it. – Perception