下载PDF在Chrome从TCPDF

时间:2020-12-28 09:48:43

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).

当在Chrome 12.0.742.91中下载PDF文件(可以作为附件和内联)时,下载被中断(开始显示125KB,之后显示127518/0 B,然后完全停止)。

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.

文件下载在Firefox和IE中工作正常。标题是正确的,apache返回200 OK。之前,一切都还好,可能直到几天前Chrome升级。

3 个解决方案

#1


2  

Just for further reference: The problem is related to the gzip handling. Disabling transparent gzip compression solved it.

仅供进一步参考:问题与gzip处理有关。禁用透明gzip压缩解决了这个问题。

#2


1  

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.

检查你的内容长度头。它返回的大小似乎比文件本身要小。我怀疑Chrome正在中断下载,因为它接收的字节比它应该接收的多。但是,在适当的地方放置一个测试用例是很容易的。

#3


0  

I had problems when the name of the file served contained weird characters like some accents (á é í ó ú) or this degree symbol: º.

我有问题的文件的名称服务包含像一些口音奇怪的字符(a e I o u)或这种程度的象征:º。

#1


2  

Just for further reference: The problem is related to the gzip handling. Disabling transparent gzip compression solved it.

仅供进一步参考:问题与gzip处理有关。禁用透明gzip压缩解决了这个问题。

#2


1  

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.

检查你的内容长度头。它返回的大小似乎比文件本身要小。我怀疑Chrome正在中断下载,因为它接收的字节比它应该接收的多。但是,在适当的地方放置一个测试用例是很容易的。

#3


0  

I had problems when the name of the file served contained weird characters like some accents (á é í ó ú) or this degree symbol: º.

我有问题的文件的名称服务包含像一些口音奇怪的字符(a e I o u)或这种程度的象征:º。