有没有办法使FPDF/FPDI或Zend_Pdf支持大于1.4的PDF的解析? [英] Is there a way to make FPDF/FPDI or Zend_Pdf support the parsing of PDFs greater than 1.4?

查看:302
本文介绍了有没有办法使FPDF/FPDI或Zend_Pdf支持大于1.4的PDF的解析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将现有的PDF(否则创建)添加到使用FPDI使用FPDF创建的PDF中.对于大多数PDF来说似乎都能正常工作,但是出现以下错误:

I am trying to add an existing PDF (created otherwise) to a PDF created with FPDF using FPDI. It seems to work find for most PDFs, but I get the following error:

FPDF error: Unable to find xref table.

经过一些测试,我发现如果使用1.4或更低版本(Acrobat v5或更低版本)的PDF,它似乎可以正常工作.查看文件似乎是因为PDF格式不同.

After some testing, I figured out that if I use a PDF version of 1.4 or lower (Acrobat v5 or lower) it seems to work. Looking at the file it seems to be because of a different PDF format.

是否有解决方法或解决方案?我可能已经有1万多个PDF用户上传,其中一些是新工作的,有些不是.同样令人烦恼的是,FPDI只是死亡,而不是导致某种错误甚至返回假

Is there a work around or solution to this? I have probably 10 000+ PDFs uploaded by users, some of the new working, some of them not. It's also annoying that FPDI just dies instead of causing some kind of error or even returning false

我现在唯一想到的解决方案是解析PDF文件的第一行以确定版本,并仅添加可以使用的版本.

The only solution I can think of right now is to parse the first line of the PDF file to determine the version and only add the ones that over versions that will work.

我还在Zend_Pdf中尝试过此操作,并使用Zend Framework随附的演示文件获得了以下结果:

I also tried this in Zend_Pdf and it had the following result, using the demo file that comes with the Zend Framework:

Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Cross-reference streams are not supported yet.' in /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf/Parser.php:331
Stack trace:
#0 /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf/Parser.php(455): Zend_Pdf_Parser->_loadXRefTable('116')
#1 /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf.php(297): Zend_Pdf_Parser->__construct('/Volumes/Docume...', Object(Zend_Pdf_ElementFactory_Proxy), true)
#2 /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf.php(250): Zend_Pdf->__construct('/Volumes/Docume...', NULL, true)
#3 /Volumes/Documents/temp/ZendFramework-1.7.7/demos/Zend/Pdf/demo.php(37): Zend_Pdf::load('/Volumes/Docume...')
#4 {main}
  thrown in /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf/Parser.php on line 331

是否无法解析大于1.4的PDF?

Is it impossible to parse PDFs greater than 1.4?

推荐答案

我发现使用

I found that using commerical version of FPDI PDF-Parser solved my problem. I've been using it for a year now and haven't had any PDFs it couln't parse (unless the PDF was corrupt or had something else weird going on).

这篇关于有没有办法使FPDF/FPDI或Zend_Pdf支持大于1.4的PDF的解析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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