views:

749

answers:

3

Hi there,

I've got some trouble with displaying pdfs in IE7 (which were generated by R&OS' ezpdf).

IE7 with Acrobat Reader 8.1.2. says "The page cannot be displayed"

Other Browsers (like FF3/Acrobat 8.1.2. or IE6/Acrobat 7) have no problem with the file.

The following headers are returned by the server:

Date: Thu, 08 Jan 2009 10:52:40 GMT
Server: Apache/2.2.8 (Win32) mod_ssl/2.2.8 OpenSSL/0.9.8g PHP/5.2.5 DAV/2
X-Powered-By: PHP/5.2.5
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 4750
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/pdf

Does anybody know how to fix this problem?

A: 

Hi,

I think I've solved the problem.

The problem is not on the server-side but on the client-side. The generated PDF is being displayed in a popup-window (javascript: window.open) and IE7 chokes on it.

When I open a html-file in the popup which is redirecting to the PDF it works.

chris
+2  A: 

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache

...so IE won't store the file in the Temporary Internet Files folder. However the mechanism used to directly 'Open' a file from the browser in IE often requires it to be opened from inside Temporary Internet Files. Directly opening a file from a browser is generally unreliable, especially in IE; 'Save as' works better.

Consider replacing the cachebusting headers with an alternative method, such as add a '?randomstring' parameter to the URL. Also consider adding a "Content-Disposition: attachment; filename=..." header, which will stop a plug-in trying and failing to display the file in the browser UI.

bobince
"Content-Disposition: attachment" also doesn't help here. You really should set the headers to allow caching.
monzee
A: 

Hi bobince,

that's it!

thank you - but I wonder why my workaround also works...

chris