Problems Executing fpdf in IE

Sometimes when we using IE to display the pdf for FPDF.
It can't generate the pdf, or It close it suddenly, or it just display with

Internet Explorer Cannot Download Error Message

but when we view in firefox it display nicely, It is something to do with the cache.

In the php file we can add this before the session_start(),

if(ereg( "MSIE", $_SERVER['HTTP_USER_AGENT'])){
session_cache_limiter('private');
}


OR ADD this..

if(ereg( "MSIE", $_SERVER['HTTP_USER_AGENT'])){
header('Cache-Control: maxage=3600');
header('Pragma: public');
}


If you are looking to send files such as PDFs or Excel spreadsheets or Microsoft Office documents and are having issues with IE7, IE6, or IE5.5 not being able to open/download the files over an SSL connection, but still need not allow caching,
then set the maxage=1
Granted, this will cache your file for one second, but it's as close to an un-cached download as you can get when using IE over SSL.

Original post from:
http://in2.php.net/manual/en/function.header.php#83219

3 comments:

  1. I was having this problem in IE since a few days ago and you saved me! Thank you!

    ReplyDelete
  2. I appreciate that you for published this information.

    ReplyDelete