我正在尝试将现有PDF(另外创建)添加到使用FPDI使用FPDF创建的PDF中.它似乎适用于大多数PDF,但我收到以下错误:
FPDF error: Unable to find xref table.
Run Code Online (Sandbox Code Playgroud)
经过一些测试,我发现如果我使用的是1.4或更低版本的Acrobat(Acrobat v5或更低版本),它似乎可行.看文件似乎是因为PDF格式不同.
有解决方法吗?我可能有10 000多个用户上传的PDF文件,其中一些是新的,有些则没有.令人讨厌的是,FPDI只是死了而不是造成某种错误甚至返回错误
我现在能想到的唯一解决方案是解析PDF文件的第一行以确定版本,并且只添加那些可以使用的版本.
编辑:
我也在Zend_Pdf中尝试了这个,它使用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
Run Code Online (Sandbox Code Playgroud)
是否无法解析大于1.4的PDF?