How to open a PDF within a PDF viewer embedded in a html page

Hi. I'm trying to modify a jsp that opens a runtime generated pdf. Originally, the pdf is opened by prompting the Adobe Reader program, but now I need to open the pdf within the jsp (which also have other content, not just display the pdf). I tried to embed the pdf in an iframe (similar to this: http://www.cs.tut.fi/~jkorpela/html/iframe-pdf.html ), but not works, it still prompts the Adobe Reader program. Actually the pdf content is generated on runtime and output through a servlet's output stream (this servlet is written by someone already left), what i did is try to open this servlet url in an iframe. If the iframe src is really a pdf file, it really works. But now the url is a servlet that output a pdf, is there anything special needed to do in the servlet in order to fulfill my requirement?

[815 byte] By [monkeynoa] at [2007-10-3 7:42:50]
# 1

i'm a bit confused...sounds like you don't like the adobe reader welcome screen poping up....or perhaps even the quick buttons that would surround the document. i believe these are unavoidable.

It also sounds like you have a servlet that returns a application/pdf mime type. ( or is at least capable of)you should be able to mark that as the source of your iframe and have no issues. i personally don't use a servlet...i use a jsp...its very easy...here's the code:

<%

response.setContentType("application/pdf");

MyDataBean db = new MyDataBean();

try {

/* pass parameters and outstream for return */

db.generatePDFFile( request, response.getOutputStream());

} catch ( Exception e ) {

response.setContentType("text/html");

out.print( "there was a problem with your request..." );

}

%>

gl, hope that helps.

ggenglisha at 2007-7-15 2:43:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks for your reply, I think I found the cause now. It is because the servlet set the http response header Content-Disposition by this line of code:

response.setHeader("Content-Disposition","attachment;filename=\"form.pdf\"");

After I remove this line from the servlet, it works.

monkeynoa at 2007-7-15 2:43:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...