You are here: Re: Problem with Internet Explorer when downloading / viewing dynamically generated PDF files « PHP « IT news, forums, messages
Re: Problem with Internet Explorer when downloading / viewing dynamically generated PDF files

Posted by Ben on 10/01/41 11:27

Frank Arensmeier said the following on 09/22/05 03:59:

> Explorer shows the PDF document as plain text only. Trying to save the
> linked document to the computer (right click) gives something like "The
> server can not be reached or the document does not exist."
>
> I know that explorer is a real p.i.t.a. when it comes to all kinds of
> web standards. And my best guess is that this could have to do with
> headers, or?

I've been down this road...

The following works for me. Note that it will cause IE to open the PDF
via the acrobat reader plugin, if you want to force IE to download the
PDF you'll need to change the header (look at the header page from
php.net for info).

// Dump the PDf to the browser

$filename="FileNumber".$_SESSION['fileNumber']."_ReportNumber".$_SESSION['reportNumber'].".pdf";
$len=strlen($reportPDF);
if(isset($_SERVER['HTTP_USER_AGENT']) &&
preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) {
// IE Bug in download name workaround
ini_set( 'zlib.output_compression','Off' );
}
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=".$filename);
print $reportPDF;


Let me know if this doesn't solve your problem.

- Ben

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация