At 02:51 PM 2/19/01 -0500, you wrote:
Has anyone encountered an issue with sending a PDF back to IE 5?

Here's my situation. I generate a PDF dynamically then store it in a
database. I then retrieve the PDF from the DB via a servlet that sets the
mime-type then outputs to the response stream. This works fine with Netscape
and IE 5.5 but with  IE 5 it displays an (mostly) empty page with a cube
icon on it (looks like an ActiveX icon). When you click on the icon it pops
up a dialog saying "Error Locating Object Handler". If I request a static
PDF IE 5 display that fine. So I'm assuming I'm not setting something on the
response properly. Any one hae any ideas?

I don't know if this is exactly your problem, be we have encountered errors in IE's handling of PDF files if the content length in not correctly set in the header.

Try something like this:

                // The technique of writing to a byte array output stream and then setting the content length was
                // taken from Paulo Soares (see the FAQ for the iText library).  If the content length is not set then the PDF
                // plugin for IE has problems with the file, especially if it is small.

                // CREATE AND SEND THE DOCUMENT.
                response.setContentType( "application/pdf" );
                ByteArrayOutputStream ba = new ByteArrayOutputStream();
                createPdfDocument( ba ); // Stream the PDF file to ba
                response.setContentLength( ba.size() );
                ServletOutputStream out = response.getOutputStream();
                ba.writeTo( out );
                out.flush();


Good luck!

-mark


Mark Meuer
Software Engineer
Life Navigator, Inc.
(612) 333-8018
http://www.lifenavigator.com
[EMAIL PROTECTED]

Reply via email to