I am new in spring mvc . so my question is how to read downloaded pdf file .my jsp page have pdf download link. and pdf is downloading properly when i click on that link but when i opened it . it shows blank file. so can anybody tell me that how to read pdf file
@RequestMapping(value = "/downloadfile", method = RequestMethod.GET)
public void downloadnotepadfile(HttpServletRequest request,
HttpServletResponse response) {
String filename = "Application-Form-2014";
try {
String path = "f:\\";
PrintWriter out = response.getWriter();
File f = new File(path + "//" + filename);
response.setContentType("application/pdf");
response.setContentLength(new Long(f.length()).intValue());
response.setHeader("Content-Disposition",
"attachment; filename=\""+filename+"\"");
PdfReader reader = new PdfReader(filename);
int a = reader.getNumberOfPages();
}
please help me.