我正在运行以下代码,并给我这个错误:FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI.我使用另一个名为pdf test.pdf,并且工作正常,但它给了我错误testcopy.pdf.
我认为这是解析器问题.任何人都知道可以与fpdf一起使用的任何其他解析器以避免此错误吗?
我的代码:
require('fpdf17/fpdf.php');
require('fpdf17/fpdi.php');
// initiate FPDI
$pdf = new FPDI();
while (ob_get_level())
ob_end_clean();
header("Content-Encoding: None", true);
// set the sourcefile
$pagecount = $pdf->setSourceFile('testcopy.pdf');
Run Code Online (Sandbox Code Playgroud)
我想在两个pdf中分割pdf,并希望在文件附件字段中附加两个pdf.如何将pdf保存到服务器.用fpdf可以实现吗?
我正在尝试将现有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?