How do I force the browser to display the pdf instead of downloading ? Here is the controller
@RequestMapping(value = "/preview.pdf", method = RequestMethod.GET)
protected String preivewSection(
HttpServletRequest request,
HttpSession httpSession,
HttpServletResponse response) {
try {
byte[] documentInBytes = getDocument();
response.setHeader("Content-Disposition", "inline; filename=\"report.pdf\"");
response.setDateHeader("Expires", -1);
response.setContentType("application/pdf");
response.setContentLength(documentInBytes.length);
response.getOutputStream().write(documentInBytes);
} catch (Exception ioe) {
} finally {
}
return null;
}