FPDF 错误:解压缩流时出错
我构建了一个包含 fpdf 库的 Web 应用程序,该应用程序允许客户上传 pdf 文件,然后我的系统将这些文件合并成月度报告(添加封面、内容页等)。
上个月我收到了这个错误:
FPDF错误:解压缩流时出错
我用谷歌搜索了它,之前遇到过它的人似乎是德国人!
错误处理程序位于 fpdi_pdf_parser.php 的第 241 行,引用了“case '/FlateDecode':”以及其他我不明白的内容。
我将问题追溯到一个看似正常但始终导致问题的 pdf 文件。我通过从旧版本中抓取屏幕来创建了新版本的 pdf,当我上传时,一切正常。
正如我所说,我解决了这个问题,但不太明白如何解决,也不想再次遇到同样的事情。
有什么想法吗?
提前致谢。
I've built a web application incorporating the fpdf library which allows clients to upload pdf files which my system then combines into a monthly report (adding a cover, contents page etc.).
Last month I got this error:
FPDF Error: Error while decompressing stream
I've googled it and the only people who have encountered it before seem to be German!
The error handler is at line 241 of fpdi_pdf_parser.php and refers to "case '/FlateDecode':" and other things I don't understand.
I traced the problem to a single pdf file which appeared normal but consistently caused the problem. I created a new version of the pdf by screen grabbing from the old one and when I uploaded that everything worked.
As I say I got round the problem but don't really understand how and don't want to run into the same thing again.
Any ideas what was going on?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PDF 文件可以使用不同的算法以不同的方式进行压缩,如果您的应用程序打开以接收任何文件,则您可能会收到 FPDF 无法解压缩的损坏文件。即使在这种情况下(我指的是损坏的文件),其他 PDF 解析器/阅读器也可能能够恢复文件并显示内容(或其某些部分),但这并不意味着该文件是有效的。
该文件也可能包含 FPDF 不支持的 PDF 规范中的某些特定功能。如果您可以选择发布有问题的文件,则可能会进一步缩小问题范围。
PDF files can be compressed in different ways with different algorithms, if your application is open to receive any file it is possible that you got a corrupt one that FPDF was not able to decompress. Even in such scenarios (I mean corrupt files) other PDF parsers/readers may be able to recover the file and show the content (or some part of it), but it does not mean the file is valid.
It is also possible that this file contains some specific feature from the PDF specification that is not supported by FPDF. If it is an option for you to post the offending file it might be possible to narrow down the issue a bit more.
通常在这种情况下可以通过 PHP 安装或更新 zlib 模块。由于图片被插入到 pdf 文档中,也会出现此问题(请参阅 上的图像要求http://www.fpdf.org/en/doc/image.htm)。
usual in such cases helps install or update zlib module by PHP. The problem also arises due to the pictures are inserted into the pdf-document (see requirements by image on http://www.fpdf.org/en/doc/image.htm).