IE
doesn't seem to pay any attention to that.
Try
naming the download *.pdf:
eg,
instead of
http://mysite.com/servlet/myservlet?downloadFile=doc.pdf
try
http://mysite.com/servlet/myservlet/doc.pdf?downloadFile=doc.pdf
This
sorted it for me!
Alistair
-Original Message-From: Suhail Rashid
[mailto:[EMAIL PROTECTED]]Sent: Wednesday, September 26, 2001
12:57 PMTo: [EMAIL PROTECTED]Subject: RE: Opening
PDF automatically in IE
Hi,
The
problem is almost certainly with your setHeader
or
setContentType statements..
make
sure u r not
setting setHeader> Content-Type
to application or octet-stream
or
Content-Disposition to attachment
which will force a download...
suhail
-Original Message-From: Peter Indelicato
[mailto:[EMAIL PROTECTED]]Sent: Wednesday, September 26,
2001 4:30 AMTo: [EMAIL PROTECTED]Subject: Opening
PDF automatically in IE
Hello Everyone.
Im pretty new to FOP, so I apologize if the answer to this question is
well known or off-topic.
Im creating a .fo file that renders fine using the FOP engine
command-line/stand alone, but when the response is sent to the browser, the
users is prompted to download a file (with a random, meaningless name, of
type PDF) instead of IE opening and displaying the PDF file
automatically. I know this is possible on my browser b/c I have other
PDF servlets (that dont use FOP) that DONT prompt for the download.
Heres the broken code:
private void renderFO(InputSource foFile, HttpServletResponse response)
throws javax.servlet.ServletException { try {
java.io.OutputStream os = response.getOutputStream();
ByteArrayOutputStream out = new
ByteArrayOutputStream(); response.setContentType("application/pdf");
response.setHeader("Content-disposition",
"filename=report.pdf"); response.setHeader("Etag",
"\"irise-" + System.currentTimeMillis() +
"\""); response.setHeader("Accept-Ranges",
"bytes"); Driver driver = new Driver(foFile,
out); driver.run();
byte[] content =
out.toByteArray(); response.setContentLength(content.length);System.out.println("content
length: " +
content.length); os.write(content); os.flush(); } catch
(Exception
e) { e.printStackTrace(); throw
new javax.servlet.ServletException(e); } }
Please help! Much appreciated.
PMI
Do You Yahoo!?Get email alerts & NEW webcam video instant
messaging with Yahoo!
Messenger.