在 Chrome 中从 TCPDF 下载 PDF
当在 Chrome 12.0.742.91 中下载 PDF 文件(无论是作为附件还是内联)时,下载会中断(开始时显示 125KB,但后来显示 127518/0 B,然后完全停止)。
文件下载在 Firefox 和 IE 中工作正常。标头正确,apache 返回 200 OK
。 以前,一切都很好,可能直到几天前 Chrome 更新。
When a downloading PDF file in Chrome 12.0.742.91 (either as an attachment and inline), the download is interrupted (at the beginning it shows 125KB, but later 127518/0 B and then it stops entirely).
The file download works correctly in Firefox and IE. Headers are correct, apache returns 200 OK
.
Previously, everything was ok, probably until a Chrome update a few days ago.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
仅供进一步参考:该问题与 gzip 处理有关。禁用透明 gzip 压缩解决了这个问题。
Just for further reference: The problem is related to the gzip handling. Disabling transparent gzip compression solved it.
检查您的内容长度标头。它返回的大小似乎小于文件本身。我怀疑 Chrome 正在中断下载,因为它收到的字节数超出了应有的字节数。然而,为此放置一个测试用例很容易。
Check your Content-Length header. It seems to be returning a size smaller than the file itself. I suspect Chrome is interrupting the download as its receiving more bytes than it should. It would be easy to put a test case in place for this however.
当所提供的文件名包含奇怪的字符(例如一些重音符号(á é í ó ú)或度数符号:º)时,我遇到了问题。
I had problems when the name of the file served contained weird characters like some accents (á é í ó ú) or this degree symbol: º.