pdf内容呈现到浏览器而不是显示

时间:2012-12-26 23:40:13

标签: php symfony1 download

使用symfony1我在服务器端准备一个pdf文件并将其返回给浏览器。在多个服务器/站点上使用相同的浏览器运行此代码时,除了一台服务器外,它工作正常。在这种情况下,pdf内容呈现在浏览器窗口中而不是嵌入显示(甚至弹出下载窗口)。这种奇怪的行为独立于浏览器(尝试使用最新的Chrome,Firefox和Safari)。请在下面找到日志行,这些在每台服务器上都是相同的。

Dec 27 00:03:30 frontend: {sfView} initialize view for "report/runReport"
Dec 27 00:03:30 frontend: {sfView} render ".../frontend/modules/report/templates/runReportSuccess.php"
Dec 27 00:03:30 frontend: {sfFilter} render to client
Dec 27 00:03:30 frontend: {sfResponse} send status "HTTP/1.0 200 OK"
Dec 27 00:03:30 frontend: {sfResponse} send header "Pragma": "public"
Dec 27 00:03:30 frontend: {sfResponse} send header "Cache-Control": "cache-control=max-age=0,must-revalidate, post-check=0, pre-check=0"
Dec 27 00:03:30 frontend: {sfResponse} send header "Content-Transfer-Encoding": "binary"
Dec 27 00:03:30 frontend: {sfResponse} send header "Content-Type": "application/pdf"
Dec 27 00:03:30 frontend: {sfResponse} send header "Content-Length": "77225"
Dec 27 00:03:30 frontend: {sfResponse} send header "Content-Disposition": "inline; filename="aging-debt.pdf""
Dec 27 00:03:30 frontend: {sfResponse} send header "Charset": "utf-8"
Dec 27 00:03:30 frontend: {sfResponse} send content (77225 o)

比较服务器环境与工作和非工作服务器的关系,两者都使用带有Suhosin-Patch的PHP 5.3.3-7 + squeeze14运行Debian 6.0。

使用简单的JavaScript window.open打开网址,在客户端没有运行其他代码或事件监听器。请告知,我应该检查什么设置来解决这个问题。谷歌,但发现只有未解决的问题,如Browser shows pdf content instead of html page some times? [closed]

0 个答案:

没有答案
相关问题