使用FPDF创建的PDF无法通过Adobe Reader打开 [英] PDF created with FPDF cannot be opened by Adobe Reader

查看:140
本文介绍了使用FPDF创建的PDF无法通过Adobe Reader打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的PDF文件无法用Adobe Reader打开.奇怪的是,该PDF仅在几天前就可以在Adobe Reader中工作,现在却无法工作,当然我没有修改代码,否则很容易修复.

我验证了我的PDF,并得知它是PDF/A-3,可能不是PDF/A-1吗?如果是这样,为什么它工作了一段时间却突然停止工作了?

编辑

问题是,不知何故,PDF文件中输出了一些HTML代码,从而使PDF文件对于Adobe Reader无效,但对于Firefox无效,这使所有这些事情比应有的混乱.

因此,无论如何都存在PDF麻烦的提示,请使用文本编辑器(例如Windows的Notepad ++或Linux的GEdit)将其打开,并与其他效果很好的PDF文件进行比较.您应该很快找到问题.

解决方案

我阅读了很多与此有关的问题,并且我了解到问题出在以下方面:

ob_start();

如果没有这一行,我的FPDF不能处理以下信息,即首先存在另一个缓冲区. 在此行中,PDF仅在浏览器中可读.

我将此行更改为:

ob_clean();

现在我可以使用任何阅读器打开PDF.

My PDF file cannot be opened with Adobe Reader. What's weird is that the PDF used to work in Adobe Reader just a few days ago and now it does not work, and of course I didn't modify the code otherwise it would be easy to fix.

I validated my PDF and learned it was a PDF/A-3, could be that it is not a PDF/A-1? If so why did it work for a time and suddenly stopped working?

EDIT

The problem was that somehow, some HTML code was output inside the PDF file, thus making the PDF file invalid for Adobe Reader, but not for Firefox, making all this much more confusing than it should be.

So a tip to anyway having trouble with PDF, open it with a text editor such as Notepad++ for Windows or GEdit for Linux, and compare with another PDF file which works fine. You should find the problem pretty quickly.

解决方案

I read a lot of questions about this and I understood that the problem is happening with:

ob_start();

Without this line, my FPDF was not working with the message explained that there was another buffer first. With this line, the PDF was readable only with Browser.

I changed this line to:

ob_clean();

and now I can open PDF with any reader.

这篇关于使用FPDF创建的PDF无法通过Adobe Reader打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆