I have an action which creates a PDF file on-the-fly, puts its contents into $this->pdf, and passes it to the template which consists only of "<?php echo $pdf ?>". The Content-type is set to "application/pdf" in the view.yml file. This works fine with Firefox, opening the contents of the PDF in a browser window.
But with Internet Explorer 7 it brings up an error dialog instead: "The file you are downloading cannot be opened by the default program. It is either corrupted or it has an incorrect file type. As a security precaution, it is recommended that you cancel the download."
The problem is that Symfony sets the Content-type header to "application/pdf; charset=utf-8". Having "charset" appear here confuses IE. (See "http://www.adobeforums.com/cgi-bin/webx/.3bc37b8a") for another report of this problem.)
I solved the problem by eliminating the template and the view.yml and instead having "echo $pdf" in the action itself. But the charset problem might bite someone else. Technically, I believe it's incorrect to specify a charset encoding for a file that's not text (whose MIME type isn't 'text/*'), so technically I think symfony is doing the wrong thing by adding "charset" indiscriminately to every page it serves (a change which was made in Changeset 1752; see 'http://trac.symfony-project.com/trac/changeset/1752'.)
Here is a patch to sfWebResponse.class.php which will work around the problem in this specific case:
line 238:
<< if (false === stripos($value, 'charset'))
if (false === stripos($value, 'charset') and false === stripos($value, 'application/pdf'))
... but I don't recommend this patch as a general solution, because it should apply to all binary files.