Forum How do I...?

PDF displays as plain text in IE 6+7

telesma
Hello,

i've have set-up an test-environment to generate dynamic Pdf's using PrinceXML and two Zope-Servers. Both connected via an RPC. The Remote-Server will start Prince, process the Pdf and return it to the Client-server. Everything works really fine!

But, Internet Explorer 6 and 7 are displaying the source of the Pdf as plain-text.... Arcobat Reader with the option "Display Pdf in Browser" is installed and HTTP-Headers are also correct....

Does anybody know what to do?

Any hints appreciated!

ciao Frank
kmmv
Are you certain the headers are correct? What headers are you sending?
telesma
I've tested all kinds of combinations. Actually I use the
'content-disposition', 'inline;filename=test2.pdf' and
'content-type', 'application/pdf' headers. But it is always the same effect. In Firefox, Safari and all other browsers the behaviour is as expected.

Here is a test link:

http://telesma.dyndns.org/ZSyncer/test2
kmmv
IE is overly picky about spacing issues. Add a space between the semicolon and the filename= field, e.g., "Content-Disposition", "inline; filename=test2.pdf".
telesma
added the spacer, but no effect...
mikeday
The HTTP response is preceded by four blank lines, and they might be confusing Internet Explorer if it's scanning for the %PDF at the beginning of the file. Other than that, everything else looks fine. Are you able to find the cause of these blank lines and remove them?
telesma
I was able to remove the blank lines. But it is the same result.

Perhaps, the pdf is broken in some way. When I save the source text on the hard drive, rename it to .pdf and open it in Acrobat Reader, he tells me the pdf is broken.

False text-encoding ??? Is this a possibility?
mikeday
That's funny, because when I view it now it displays the PDF properly in Internet Explorer 6 on Windows XP, loading it up in an embedded Acrobat window in the browser. Try refreshing perhaps, to make sure it's not using a cached version?
telesma
oh, yes... closed the browser and started it again.

Now it works!!!

Thanks a lot. Prince is a cool tool !!!