首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“不正确地引用对象”或“消息:大纲儿童加载错误。”

“不正确地引用对象”或“消息:大纲儿童加载错误。”
EN

Stack Overflow用户
提问于 2014-08-13 19:09:30
回答 1查看 411关注 0票数 1

这个程序正在用Zend_Pdf创建PDF附件并加载pdf文件。我知道Zend_Pdf只能使用等于或低于1.4版本的PDF文件。

所有文件的版本为1.3。创建并正确附加五个pdf附件,但一个文件在加载时会产生错误。我不知道原因是什么,以及如何解决这个问题:

错误1:当文件被降级为1.3版本时,

代码语言:javascript
复制
An error occurred

Application error

Exception information:

Message: Outline childs load error.

Stack trace:

#0 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Outline\Loaded.php(345): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference), Object(SplObjectStorage))
#1 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Outline\Loaded.php(345): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference), Object(SplObjectStorage))
#2 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Outline\Loaded.php(345): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference), Object(SplObjectStorage))
#3 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Outline\Loaded.php(345): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference), Object(SplObjectStorage))
#4 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Outline\Loaded.php(345): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference), Object(SplObjectStorage))
#5 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Outline\Loaded.php(345): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference), Object(SplObjectStorage))
#6 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Outline\Loaded.php(345): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference), Object(SplObjectStorage))
#7 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Outline\Loaded.php(345): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference), Object(SplObjectStorage))
#8 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf.php(549): Zend_Pdf_Outline_Loaded->__construct(Object(Zend_Pdf_Element_Reference))
#9 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf.php(317): Zend_Pdf->_loadOutlines(Object(Zend_Pdf_Element_Reference))
#10 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf.php(253): Zend_Pdf->__construct('C:\WebSites\Web...', NULL, true)
#11 C:\WebSites\Web_Applications\workstudy\application\modules\default\models\Students.php(609): Zend_Pdf::load('C:\WebSites\Web...')
#12 C:\WebSites\Web_Applications\workstudy\application\modules\default\controllers\StudentsController.php(262): Model_Students->generateDocuments()
#13 C:\WebSites\Web_Applications\workstudy\library\Zend\Controller\Action.php(513): StudentsController->quizCompletedAction()
#14 C:\WebSites\Web_Applications\workstudy\library\Zend\Controller\Dispatcher\Standard.php(289): Zend_Controller_Action->dispatch('quizCompletedAc...')
#15 C:\WebSites\Web_Applications\workstudy\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#16 C:\WebSites\Web_Applications\workstudy\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#17 C:\WebSites\Web_Applications\workstudy\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#18 C:\WebSites\RSS\Workstudy\index.php(26): Zend_Application->run()

**错误2:当文件没有正确地降级到较低的版本时可能会发生**

代码语言:javascript
复制
An error occurred

Application error

Exception information:

Message: Incorrect reference to the object

Stack trace:

#0 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf\Element\Reference.php(128): Zend_Pdf_Element_Reference->_dereference()
#1 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf.php(529): Zend_Pdf_Element_Reference->getType()
#2 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf.php(317): Zend_Pdf->_loadOutlines(Object(Zend_Pdf_Element_Reference))
#3 C:\WebSites\Web_Applications\workstudy\library\Zend\Pdf.php(253): Zend_Pdf->__construct('C:\WebSites\Web...', NULL, true)
#4 C:\WebSites\Web_Applications\workstudy\application\modules\default\models\Students.php(597): Zend_Pdf::load('C:\WebSites\Web...')
#5 C:\WebSites\Web_Applications\workstudy\application\modules\default\controllers\StudentsController.php(262): Model_Students->generateDocuments()
#6 C:\WebSites\Web_Applications\workstudy\library\Zend\Controller\Action.php(513): StudentsController->quizCompletedAction()
#7 C:\WebSites\Web_Applications\workstudy\library\Zend\Controller\Dispatcher\Standard.php(289): Zend_Controller_Action->dispatch('quizCompletedAc...')
#8 C:\WebSites\Web_Applications\workstudy\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#9 C:\WebSites\Web_Applications\workstudy\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#10 C:\WebSites\Web_Applications\workstudy\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#11 C:\WebSites\RSS\Workstudy\index.php(26): Zend_Application->run()
#12 {main}  

Php代码:

代码语言:javascript
复制
...

$mail = new Zend_Mail();
$mail->setFrom(Zend_Registry::get('config')->app->contact->email);
$mail->addTo($this->getUscEmail(), $this->getFirstName().' '.$this->getLastName());
$mail->addCc(Zend_Registry::get('config')->app->contact->email, 'SOWK FWS');
$mail->setSubject('Workstudy Documentation - '.$this->getFirstName().' '.$this->getLastName());
$content = '......text......';

$mail->setBodyText(strip_tags($content));
$mail->setBodyHtml($content);


...

$file = Zend_Registry::get('config')->app->pdf_path."Foundation Year Students.pdf"; //load pdf from string
$pdf = Zend_Pdf::load($file);
$at1 = $mail->createAttachment($pdf->render());
$at1->filename = "Foundation Year Students steve.pdf";
$at1->type        = 'application/pdf';

...
EN

回答 1

Stack Overflow用户

发布于 2014-08-13 21:04:22

另一种附加相同文件的方法解决了这个问题:

代码语言:javascript
复制
    $file = Zend_Registry::get('config')->app->pdf_path."Foundation Year Students-Instructions.pdf"; //load pdf from string
            $content = file_get_contents($file); // e.g. ("attachment/abc.pdf")
    $attachment = new Zend_Mime_Part($content);
    $attachment->type = 'application/pdf';
    $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
    $attachment->encoding = Zend_Mime::ENCODING_BASE64;
    $attachment->filename = 'Foundation Year Students-Instructions.pdf'; // name of file

    $mail->addAttachment($attachment);   
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25294246

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档