打开PDF时“图像数据不足”消息 [英] 'insufficient data for an image' message when opening PDF

查看:1106
本文介绍了打开PDF时“图像数据不足”消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的php cli应用程序使用TCPDF库创建PDF。在大多数情况下,PDF是成功创建的,但有时创建的PDF会让adobe reader弹出错误:图像数据不足。

My php cli application creates PDF's by using the TCPDF library. In most cases PDF's are created successfully, but sometimes a PDF is created that makes adobe reader pop up the error: 'insufficient data for an image'.

我显然做了一些研究这个消息,并没有任何指定的原因和提供的解决方案在我的情况下或解决问题。虽然Adobe产品是唯一出现错误的产品,而其他PDF查看器可以打开损坏的文件并将其显示正确,但这并不意味着它与adobe相关的问题。对于高级PDF编辑器,NITRO 9可以显示损坏的文件,但同时会检测到问题并弹出警报。

I obviously did some research on this message, and none of the named causes nor provided solutions are relevant in my case or solve the problem. Although Adobe products are the only ones that pop up an error and other PDF viewers can open the corrupt file and display it correct, this doesn't mean it's an adobe related problem. For an advanced PDF editor, NITRO 9, can display the corrupt files but at the same time does detect the issue and pops up an alert.

通过使用Nitro,我能够修复PDF文件。步骤是:从pdf中提取损坏的图像对象中的图像,然后用保存的图像替换pdf文件中的图像...

By using Nitro I am able to fix the PDF file. Steps are: extract the image from the corrupt image object from the pdf and then replace the image in the pdf file by the saved image...

触发的特定图像错误/警报不是一种类型(fe jpg2000)。 BMP,png和gif也触发了erorr / alert。

The specific images that trigger the error/alert aren't of one type (f.e. jpg2000). BMP, png and gifs have triggered the erorr/alert as well.

我在stackoverflow上读了几个类似的话题,'XOBJECT流'可能会出错?但是,我不知道如何检查这个。

I read in a few similar topics on stackoverflow that the 'XOBJECT stream' might be malformed? However, I have no idea how to check this.

我希望你们其中一个人知道在哪里看。

I hope one of you guys knows where to look.

我也尝试在TCPF表单上查找类似的主题,但是创建者告诉主题启动者这是一个adobe问题或pdf问题,他不能帮助他们。

I tried to look for similar topics on the TCPF form as well, but the creator tells the topic starters this is an adobe issue or a pdf issue and he can't help them.

附加文件
我上传了两个pdf文件:一个带有错误图像的文件触发错误( naamloos1_bad.pdf)和一个使用Nitro固定的(naamloos1_fixed.pdf)。您可以下载此处

我希望有PDF文件类型知识的人可以比较这些,并让我知道出现问题的详细信息,以便我知道在我的代码和TCPDF库中寻找什么以解决这个问题。

I hope someone with knowledge of the PDF file type can compare these and let me know details on what's going wrong so I know what to look for in my code and that of the TCPDF library in order to fix this issue.

PDF文件中的右下角图像是触发警报/错误的图像。

The bottom-right image in the PDF file is the one that triggers the alert/error.

谢谢!

推荐答案

好吧,至少我发现了我可以自动化的解决方法。我没有学到更多关于这个问题的内容,但是如果这个主题结束了,人们将来会阅读它,那么它就是:

Okay, so at least I found a workaround that I can automatize. I learned nothing more about this issue, but in case this topic ends dead and people read it in the future, here it is:

我正在运行Linux并且像这样调用ghostscript :

Im running Linux and calling ghostscript like this:

gs -sDEVICE = pdfwrite -dCompatibilityLevel = 1.7 -dPDFSETTINGS = / printer -dNOPAUSE -dQUIET -dBATCH -dUseCIEColor -sOutputFile = ouput.pdf input.pdf

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.7 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -dUseCIEColor -sOutputFile=ouput.pdf input.pdf

将以不足的数据错误消失的方式修复pdf。 (请注意,设置了一些参数,因为我需要为print创建pdf。如果你不需要它,请将dPDFSETTINGS设置为/ screen,f.e。)

will repair the pdf in such a way the insufficient data error goes away. (Note that some arguments are set because I need to create pdfs for print. If you dont need it, set dPDFSETTINGS to /screen, f.e.)

这篇关于打开PDF时“图像数据不足”消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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