-----Original Message-----
From: Suhail Rashid [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 26, 2001 12:57 PM
To: [EMAIL PROTECTED]
Subject: RE: Opening PDF automatically in IEHi,The problem is almost certainly with your setHeaderor setContentType statements..make sure u r notsetting <in setHeader> Content-Type to application or octet-streamorContent-Disposition to attachmentwhich will force a download...suhail-----Original Message-----
From: Peter Indelicato [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 26, 2001 4:30 AM
To: [EMAIL PROTECTED]
Subject: Opening PDF automatically in IEHello 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.
IE
doesn't seem to pay any attention to that.
Try
naming the download *.pdf:
eg,
instead of
This
sorted it for me!
Alistair
- Opening PDF automatically in IE Peter Indelicato
- RE: Opening PDF automatically in IE Suhail Rashid
- Alistair Hopkins