我目前正在尝试使用该Zend_Pdf::load($filename)
方法加载 PDF 文档,我得到了
Error occured while 'xxx.pdf' file reading.
所以我在 Zend_Pdf_Parser::_construct 看到有这个块
while ($byteCount > 0 && !feof($pdfFile)) {
$nextBlock = fread($pdfFile, $byteCount);
if ($nextBlock === false) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception( "Error occured while '$source' file reading." );
}
$data .= $nextBlock;
$byteCount -= strlen($nextBlock);
}
if ($byteCount != 0) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception( "Error occured while '$source' file reading." );
}
调试后,我可以说strlen($nextBlock)
没有返回正确的值(基于$nextBlock = fread($pdfFile, $byteCount);
)如果我mb_strlen($nextBlock,'8bit')
改用这个块,则正确传递。现在我收到另一个错误
Pdf file syntax error. 'startxref' keyword expected
所以现在我查看 Zend_Pdf_StringParser:readLexeme() 并且我可以再次看到单字节与多字节字符串函数(strlen 等)存在问题
那么有没有人知道 Zend_Pdf 发生了什么,如果这是一般错误或者我只是错过了一些东西?