Hi
i am getting this error while displaying PDF from
jsp. "Adobe reader could not open'report1.pdf' because it is either not a supported file type or because the file has been corrupted(for example, it was sent as an email attachment and wasn't correctly decoded".
below code used for this purpose.
byte byteArray[]="this is to generate the PDF file".getBytes();
logger.debug("********* byte array *********"+ byteArray);
response.setContentLength(byteArray.length);
response.setContentType("application/"+rptFormat[--count]);
response.setHeader("Cache-Control", "no-cache"); //HTTP 1.1
response.setHeader("Cache-Control", "max-age=0");
response.setHeader("Content-disposition", "attachment; filename=Report1.pdf");
ServletOutputStream out;
try {
out = response.getOutputStream();
out.write(byteArray);
out.flush();
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.getMessage();
}
actually i want to display pdf, excel, rpt, and xml. please let me know the issue in this code.
thanks in advance.
regards
Purush