Okay I think I've got a work around for it, thanks for everyones
suggestions.

I set the ContentLength

I need to determine if the browser is IE5, 
then set the Content-disposition header to 
        "attachment;filename=\"somefilename.pdf\""
else set the Content-disposition header to 
        "inline;filename=\"somefilename.pdf\""

Now I just need to test this with other browsers.

> -----Original Message-----
> From: Thomas Munro [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 20, 2001 8:51 AM
> To: [EMAIL PROTECTED]
> Cc: Orion-Interest
> Subject: Re: Sending a PDF via a servlet to IE 5
> 
> 
> Have you tried setting the Content-disposition header?
> 
> "Van Dooren, Damian" wrote:
> > 
> > Unfortunately setting the content length didn't have any 
> effect on the
> > problem. Thanks anyways for the suggestion.
> > 
> > -----Original Message-----
> > From: Mark Meuer [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 19, 2001 4:03 PM
> > To: Orion-Interest
> > Subject: Re: Sending a PDF via a servlet to IE 5
> > 
> > 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]
> 
> -- 
> Thomas Munro <[EMAIL PROTECTED]>
>  http://www.fullsix.com/
>  Fullsix Technology (Paris)
> 

Reply via email to