InputStream in = null;
ServletOutputStream out = null;
String filePath = this.getServlet().getServletContext()
.getRealPath("/")
+ "pdffiles" + File.separator +"HelpManual.pdf";
try {
response.reset();
out = response.getOutputStream();
response.setContentType("application/pdf");
in = new BufferedInputStream(new FileInputStream(filePath));
int ch;
while ((ch = in.read()) != -1) {
out.print((char) ch);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.flush();
out.close();
}
}