HI guys ,
When i am trying to open a PDF through a
servlet it is poping with an acrobat error with the message
" The file is damaged and couldnot bt opened"
I am using the following code to display the pdf file from the serlvet,
File reportFile = new File(pdfFilename);
OutputStream ost = res.getOutputStream();
res.setHeader("Content-Disposition", "inline;filename="+pdfFilename+"\"");
res.setContentType("application/pdf");
BufferedInputStream buffIn = new BufferedInputStream(new FileInputStream(reportFile));
int iBuf;
while ((iBuf=buffIn.read())!=-1)
ost.write((byte) iBuf);
ost.flush();
buffIn.close();
ost.close();
If any problem in the code please let me know.