Re: Serving PDFs via servlet
Come across this one in a couple of places and seems to be a problem
more to do with the browsers. I was using xsl-fo to generate the pdf.
All worked fine from a swing application but when trying to access the
same document on the web I had to add ?dummy=.pdf to the end of the url
and it worked fine. (I'm using Acrobat5).
Almost seems that the browser is ignoring the mime type.
Owen
Richard McLaren wrote:
> We have a simple servlet that fetches a PDF from a database and sends it back
> with the content type set to application/pdf.
>
> This works fine in most cases but in some IE browsers the pdf displays as
> a blank page or a little image icon. It will display properly if you save
> the file to disk then open it or if you turn off web integration on Acrobat4
> so that it loads up acrobat in a separate window.
>
> The Adobe site suggests using Netscape (not acceptable) or saving the pdf
> to a file on the web server and sending back a dummy HTML page with a refresh
> pointing to the file (works but messy).
>
> Curiously using a sendRedirect() does not work but sending back a dummy page
> with a META line to redirect does work????
>
> Has anybody come up with a better solution.
>
> We are using Apache 1.3.6 on an HPUX box.
>
> Richard McLaren
> richardmclaren@hotmail.com
>
Re: Serving PDFs via servlet
Hi,
well I had my problems too with the combination servlet-PDF. I found out
that it is a problem in IE when serving the PDF in HTTPS mode and only when
WebLogic is the server. Tomcat does not have that problem.
HTTP works fine, just set the "Content-Type" to "application/pdf".
Ash
Owen Thomas <owen.thomas@simpl.co.nz> wrote:
>Come across this one in a couple of places and seems to be a problem
>more to do with the browsers. I was using xsl-fo to generate the pdf.
>
>All worked fine from a swing application but when trying to access the
>same document on the web I had to add ?dummy=.pdf to the end of the url
>and it worked fine. (I'm using Acrobat5).
>
>Almost seems that the browser is ignoring the mime type.
>
>Owen
>
>Richard McLaren wrote:
>> We have a simple servlet that fetches a PDF from a database and sends
it back
>> with the content type set to application/pdf.
>>
>> This works fine in most cases but in some IE browsers the pdf displays
as
>> a blank page or a little image icon. It will display properly if you save
>> the file to disk then open it or if you turn off web integration on Acrobat4
>> so that it loads up acrobat in a separate window.
>>
>> The Adobe site suggests using Netscape (not acceptable) or saving the
pdf
>> to a file on the web server and sending back a dummy HTML page with a
refresh
>> pointing to the file (works but messy).
>>
>> Curiously using a sendRedirect() does not work but sending back a dummy
page
>> with a META line to redirect does work????
>>
>> Has anybody come up with a better solution.
>>
>> We are using Apache 1.3.6 on an HPUX box.
>>
>> Richard McLaren
>> richardmclaren@hotmail.com
>>
>
>