Our application is XML based, so we use FOP to dynamically generate PDFs on
the fly.  This works fine with IE 5.x and NS 4.x.  We serve from Tomcat in
standalone mode plus attached to IIS and Apache.  The only issue we found,
as people have mentioned earlier, you have to do the following:
1. Call HttpServletResponse.reset() to clear the HTTP headers.
2. Call HttpServletResponse.setContentType("application/pdf") to set the
mime type.
3. Call HttpServletResponse.setContentLength(contentLength) to set the size
of the PDF being sent back.
4. Call HttpServletResponse.flushBuffer() to flush the contents of the
buffer.

We do 1 - 3 prior to writing the PDF to the output stream.


Jim Urban - [EMAIL PROTECTED]
Park City Solutions Inc.
Clinical Connectivity Suite Product Manager
Suite 295
500 Park Blvd.
Itasca, IL  60143
Voice:  (630) 250-3045 x106
Fax:  (630) 250-3046

CONFIDENTIALITY NOTICE
This message and any included attachments are from Park City Solutions Inc.
and are intended only for the entity to which it is addressed. The contained
information is confidential and privileged material. If you are not the
intended recipient, you are hereby notified that any use, dissemination, or
copying of this communication is strictly prohibited and may be unlawful. If
you have received this communication in error please notify the sender of
the delivery error by e-mail or call Park City Solutions Inc. corporate
offices at (435) 654-0621

-----Original Message-----
From: Jeff Larsen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 4:46 PM
To: Tomcat Users List
Subject: Re: REPOST: Problems serving PDF to Netscape browsers

As much as it pained me to do so, I tried generating static
files and redirecting, but it still behaved the same way!!!

It's got to be something about iText that the Netscape/Acrobat
combination doesn't like. Too bad there aren't any (free) packages
better than iText! Has anybody worked with Big Faceless?

Jeff

----- Original Message -----
From: "Andy Eastham" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, May 14, 2002 3:54 PM
Subject: RE: REPOST: Problems serving PDF to Netscape browsers


> Jeff,
>
> As a last resort, you could write the pdf to a temporary directory
> accessible via apache, then send the browser a redirect to that file.
That
> way, the actual PDF will be served by apache, not Tomcat.  You'll
obviously
> have to tidy up the generated PDFs periodically, although the temp file
> methods in java.io.File should help. Also, java.util.Timer is useful for
> writing jobs which do clean up tasks.
>
> This is of course undesirable, but sometimes you just have to do what it
> takes to make something work... :-(
>
> Good luck,
>
> Andy
>
> > -----Original Message-----
> > From: Jeff Larsen [mailto:[EMAIL PROTECTED]]
> > Sent: 14 May 2002 17:01
> > To: [EMAIL PROTECTED]
> > Subject: REPOST: Problems serving PDF to Netscape browsers
> >
> >
> > I've made no progress on this, so let's try again. My dynamic
> > PDF is working perfectly with MSIE 4, 5, and 6, but I'm still
> > having problems with Netscape (ver 4 and 6) and the Acrobat
> > (ver 4 and 5) plugin. I've tried this on various client machines.
> >
> > With both NS4 and NS6, I just get a blank screen when I request
> > my dynamic PDF. They don't even show the Acrobat toolbar. The
> > similarities end there.
> >
> > In NS4, the first request does not launch the AcroRd32.exe
> > process. In fact, it fails to read the entire output of the
> > servlet and Tomcat (4.0.3) spits out a Broken Pipe exception
> > to the logs. If I hit "Reload", however, I get my PDF and the
> > plugin works. According to the Apache logs, the first unsucessful
> > request returns 6144 of 21212 bytes before the broken pipe. On
> > the "Reload", the Apache log shows TWO requests returning the
> > full 21212 bytes and Netscape displays it in the plugin.
> >
> > In NS6, the first request DOES launch the plugin executable, but
> > that's as far as it gets. "Reload" doesn't help. My Apache server
> > reports the correct number of bytes for the full PDF request, so the
> > data seems to be getting to the browser. No exceptions are thrown
> > by Tomcat.
> >
> > In both NS4 and NS6, it works if I configure Acrobat to be launched
> > as an external application instead of a plugin. But it is not a
> > viable option to impose that configuration on our customers.
> >
> > I use a servlet mapping that sends requests for xxx.pdf to my
> > servlet, thus the browser sees a ".pdf" filename. I also use
> > setContentType("application/pdf"). There are known problems
> > with MSIE and unknown ContentLength with PDF so I create the
> > PDF in a ByteArrayOutputStream so I can know and set the
> > ContentLength before writing to response.getOutputStream().
> >
> > To take the dynamic nature of the PDF out of the equation, I was
> > able to reproduce these problems --sometimes-- when serving static
> > PDF files via Tomcat.
> >
> >
> > ----- Original Message -----
> > From: "Jeff Larsen" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, May 09, 2002 1:44 PM
> > Subject: Problems serving PDF to Netscape browsers
> >
> >
> > > I'm running out of hair to pull out here...
> > >
> > > My ultimate goal is to serve dynamically generated
> > > PDF documents generated with iText. I've got it working
> > > just fine with MSIE. However, I was just getting blank
> > > pages with Netscape (and it wasn't even showing the toolbar
> > > for Acrobat). With NS6 I could at least see that it started
> > > an AcroRd32.exe process, but NS4 didn't even get that far.
> > >
> > > So, I did some tests to rule out some variables. I grabbed
> > > a handful of pre-generated PDF files and stuck them on
> > > my Apache 1.3.23 server. All browsers could display the
> > > PDFs just fine.  Then I set up Tomcat 4.0.3 to server the
> > > same files directly without going through Apache. MSIE worked,
> > > but both NS browsers gave a blank page with no Acrobat plugin
> > > toolbar. Again NS6 managed to start an Acrobat process, NS4
> > > didn't.
> > >
> > > My production environment is Apache 1.3.23 and Tomcat 4.0.3
> > > connected with mod_jk.
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to