You are here: php, Adobe and IE getting things wrong again. « PHP Language « IT news, forums, messages
php, Adobe and IE getting things wrong again.

Posted by Ian Hobson on 12/01/07 22:48

Hi All,

I have a web app written in php, that generates a pdf file on the fly.

I think I need to kill the headers that php is automatically generating,
and I don't know how to do it.

The basic idea is that the href in the anchor is to a URL of the form

http://domain.com/sop/print/quote27.pdf

This is processed by modrewrite into

/sop/index.php?view=quote&id=27&act=print

The code creates the .pdf, prepends a

header('Content-Disposition',"inline; filename="quote27.pdf"');

and sends it back. The browser then uses adobe acrobat to display the
result. Using standard adobe plugins the resulting file can be printed
or emailed - all very user friendly etc.

Everything works absolutely fine under Firefox - no errors, no warnings,
just the desired results.

But when I try it with IE, I get

"There was an error opening this document. The file cannot be found"

Googling the error message gives 3 pages of results. Although I found
lots to try, nothing has worked so far.

I have tried...

Cache-Control Pivate and Public - neither made any difference.
Checked the security of the site is "medium" or "permitted", and that
"software channel" and "Launch program in Iframe" are permitted - They are.
Ive deleted all off-line content, and the index.dat file and rebooted,
to remove errors in the cache.
I have been advised to avoid Unicode characters in external links -
there are no links, internal or external.
Add a Content-Tranfer-Encoding" header with value Binary - made no
difference.

I tried various combinations of Content-Disposition header. If it was
"inline", "attachment" Firefax worked and IE/Adobe complained it could
not find the file.

If I modified the Adobe Edit/Options/Internet and cleared the "Show PDF
in browser (and rebooted), then IE complains that it can't download
<file> from <site>.

"Internet Explorer was not able to open this Internet site. The
requested site is either unavailable or cannot be found. Please try
later." The site is served by Apache running as a service on the same
machine as the browser - and no it has not gone down. Doing the same in
FireFox saves the file (unprompted) to file.pdf (not quote27.pdf).

After MUCH testing and debugging I have discovered that php has the
following headers *already* set up to go before I start adding mine.

array(4) {
[0]=>
string(23) "X-Powered-By: PHP/5.2.3"
[1]=>
string(38) "Expires: Thu, 19 Nov 1981 08:52:00 GMT"
[2]=>
string(77) "Cache-Control: no-store, no-cache, must-revalidate,
post-check=0, pre-check=0"
[3]=>
string(16) "Pragma: no-cache"
}

This is usually fine for a php file, but its not what I want for these
..pdf files, and I suspect they are stopping IE store the file in the
cache, which is why Adobe can't find it! I can't find any quote27.pdf
files either.

How can I remove these headers?

Ans how can I have a look at the headers that are actually sent? I tries
wireshark, but the http never gets onto a wire, so wireshark can't grab
it! :(

All help gratefully received.

Ian

Environment - Apache 2.0, php 5. Adobe Acrobat 8.1.1
Firefox 2, IE6 under window 2000 SP4.

Target - IE7 under a mix of Vista and XP machines.

 

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

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