Make your URL end with ".pdf", a dummy parameter will do. IE looks a lot closer at the URL ending than at the content type.
Best Regards, Paulo Soares ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 01, 2003 11:28 Subject: [iText-questions] Pdf can be viewed after saved but not embed inside browser Dear All, My application wants to get some data from database and display the result in a table in pdf format within a browser. I'm using a structs framework and all the packaging of the data is done within my service class. When I forward to my JSP, I invoke a servelet using the following code: //jsp file <%@ page contentType="application/pdf" %> <%@ page import="javax.servlet.*, javax.servlet.http.*" %> <% getServletConfig().getServletContext().getRequestDispatcher("/servlet/Repor tServlet").forward(request, response); %> I did not use the servlet mapping because I already have another servlet dealing with *.pdf in another way, I want to specifically invoke this servlet class from the .jsp. In my servlet, I do the usual settting and try to output to the browser as streaming PDF. But the browser keep asking me to save the file and it has extension .do with it. If I save to disk, I can open the pdf and see the file the way I intended it to be. If I set the Header with content-disposition("attachement;"report.pdf"), then I get the popup asking me to either save or open. If I open, Adobe Reader will be invoked, but I want the pdf to come within the browser. If I sent content-disposition to "inline", then I'll get a broken .gif image in my popup for IE5.5 and some error that crashes the browser in IE6.0. Do you know what went wrong? // ReportServlet *snip* //get my prepared data. Context context = (Context) request.getAttribute(some_name); ByteArrayOutputStream os = (ByteArrayOutputStream) context.getResult().elementAt(0); byte[] content = os.toByteArray(); response.reset(); response.setContentType("application/pdf"); response.setContentLength(content.length); response.setHeader("Content-Disposition","inline;filename=report.pdf" ); response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Cache-Control", "max-age=30"); response.setHeader("Pragma", "public"); response.getOutputStream().write(content); response.getOutputStream().flush(); response.getOutputStream().close(); *end of code* I've read the online help and tried all sorts of combinations including setContentType, setContentLength and all kinds of header setting but still can't resolve the problem. I even tried to active-X control setting on the IE. If I do everything in my structs action and forward to a .jsp, will it make a difference? I need to resolve this problem soon. Any kind of help is appreciated. Thanks & Regards, Anthony -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ . ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions