我想以下幾點: 我想開一個現有的PDF文檔,並檢查每個頁面的寬度在裏面。閱讀和檢查PDF文件
$pdf = Zend_Pdf::Load($fullFilePath);
foreach($pdf->pages As $key => $page)
{
$width = $page->getWidth();
}
但我每次都會得到相同的寬度。即使有「雙頁」(明白我的意思看http://www.reinkesupply.com/Acoustical%20Cross-Reference.pdf)
我有一個問題。我希望用交叉引用PDF來完成。 任何人都可以給我任何提示我應該修補什麼來達到目標? 如前所述我只打開PDF文件並檢查頁面寬度。
在檢查幾個DOS,我發現了以下錯誤:
Message:
PDF file syntax error. Offset - 0x12E9048. Wrong W dictionary entry. Only type field of stream entries has default value and could be zero length.
Stack trace:
#0 C:\xampp\htdocs\qs\library\Zend\Pdf\Parser.php(455): Zend_Pdf_Parser->_loadXRefTable('19828808')
#1 C:\xampp\htdocs\qs\library\Zend\Pdf.php(297): Zend_Pdf_Parser->__construct('C:\xampp\htdocs...', Object(Zend_Pdf_ElementFactory_Proxy), true)
#2 C:\xampp\htdocs\qs\library\Zend\Pdf.php(250): Zend_Pdf->__construct('C:\xampp\htdocs...', NULL, true)
#3 C:\xampp\htdocs\qs\application\controllers\IndexController.php(18): Zend_Pdf::load('C:\xampp\htdocs...')
#4 C:\xampp\htdocs\qs\library\Zend\Controller\Action.php(503): IndexController->indexAction()
#5 C:\xampp\htdocs\qs\library\Zend\Controller\Dispatcher\Standard.php(285): Zend_Controller_Action->dispatch('indexAction')
#6 C:\xampp\htdocs\qs\library\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#7 C:\xampp\htdocs\qs\public\index.php(24): Zend_Controller_Front->dispatch()
#8 {main}
我想這是因爲交叉引用。我對嗎?有沒有簡單的方法來解決它?
由於
喜詹姆斯,非常感謝你的詳細解答。你也可以給我任何提示如何改變框架,我可以打開並閱讀交叉參考文檔?或者這會是一件相當困難的工作?因爲如果我不能閱讀交叉參考PDF文件,我必須使用別的東西....謝謝! – user897237 2012-02-15 15:20:08
我不知道這是否會起作用(它不適用於上面提到的示例文檔),但可能需要進一步調查: foreach($ pdf-> getNamedDestinations()as $ destination) 如果($ destination-> isRemote()) { echo $ destination-> getResource() - > toString(),「\ n」; } } – JamesG 2012-02-16 03:23:05
嗨,詹姆斯,謝謝你的反饋!我編輯了我的問題。如果您不介意我會請您查看一下。交叉引用引起的錯誤是什麼?謝謝! – user897237 2012-02-16 13:52:29