I have written a jsp page to display contents of pdf, but end up with ascii codes in jsp. I want to display the contents of pdf in jsp. Whats the part that I have missed. Wh
I could see multiple problems:
application/pdf)In the while loop, data are first written to the response output stream, then a toString() is written to the out (which is actually a Writer instance opened on the response output stream - the one in outs). Only use the response stream in the loop, as
while ((c = in.read(buf, 0, buf.length)) > 0) {
outs.write(buf, 0, c);
}