Hi,
 
The problem is almost certainly with your setHeader
or setContentType statements..
 
make sure u r not
setting <in 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 AM
To: [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.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to