我有一个脚本可以生成多个报告,每个报告都使用DOMPDF转换为pdf。报告的大小和内容类型各不相同,但通常混合使用图像,表格和程式化文本。
在我试图转换的最新报告中,我收到了以下错误:
Exception information:
Message: foo
Stack trace:
#0 library/dompdf/include/table_row_frame_reflower.cls.php(83): Cellmap->get_frame_height(Object(Table_Row_Frame_Decorator))
#1 library/dompdf/include/frame_decorator.cls.php(477): Table_Row_Frame_Reflower->reflow(NULL)
#2 library/dompdf/include/table_frame_reflower.cls.php(481): Frame_Decorator->reflow()
#3 library/dompdf/include/frame_decorator.cls.php(477): Table_Frame_Reflower->reflow(Object(Block_Frame_Decorator))
#4 library/dompdf/include/block_frame_reflower.cls.php(706): Frame_Decorator->reflow(Object(Block_Frame_Decorator))
#5 library/dompdf/include/frame_decorator.cls.php(477): Block_Frame_Reflower->reflow(Object(Block_Frame_Decorator))
#6 library/dompdf/include/inline_frame_reflower.cls.php(96): Frame_Decorator->reflow(Object(Block_Frame_Decorator))
#7 library/dompdf/include/frame_decorator.cls.php(477): Inline_Frame_Reflower->reflow(Object(Block_Frame_Decorator))
#8 library/dompdf/include/block_frame_reflower.cls.php(706): Frame_Decorator->reflow(Object(Block_Frame_Decorator))
#9 library/dompdf/include/frame_decorator.cls.php(477): Block_Frame_Reflower->reflow(Object(Block_Frame_Decorator))
#10 library/dompdf/include/block_frame_reflower.cls.php(706): Frame_Decorator->reflow(Object(Block_Frame_Decorator))
#11 library/dompdf/include/frame_decorator.cls.php(477): Block_Frame_Reflower->reflow(Object(Block_Frame_Decorator))
#12 library/dompdf/include/block_frame_reflower.cls.php(706): Frame_Decorator->reflow(Object(Block_Frame_Decorator))
#13 library/dompdf/include/frame_decorator.cls.php(477): Block_Frame_Reflower->reflow(NULL)
#14 library/dompdf/include/page_frame_reflower.cls.php(169): Frame_Decorator->reflow()
#15 library/dompdf/include/frame_decorator.cls.php(477): Page_Frame_Reflower->reflow(NULL)
#16 library/dompdf/include/dompdf.cls.php(680): Frame_Decorator->reflow()
#17 application/controllers/NetworthController.php(332): DOMPDF->render()
#18 library/ZendFramework-1.11.0/ZendFramework-1.11.0/library/Zend/Controller/Action.php(513): NetworthController->reportAction()
#19 library/ZendFramework-1.11.0/ZendFramework-1.11.0/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('reportAction')
#20 library/ZendFramework-1.11.0/ZendFramework-1.11.0/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#21 library/ZendFramework-1.11.0/ZendFramework-1.11.0/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#22 library/ZendFramework-1.11.0/ZendFramework-1.11.0/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#23 index.php(150): Zend_Application->run()
#24 {main}
我通过验证器运行了输入到DOMPDF的html,并且没有错误或警告。报告确实包含了几个表,但没有一个表会被强制拆分多个页面(最长的表大约是页面的三分之一)。除了无效的HTML之外,我不确定是什么导致这种情况,并且搜索此错误仅表明这是一个潜在原因。
建议?
答案 0 :(得分:4)
我阅读了这篇文章https://groups.google.com/forum/?fromgroups#!topic/dompdf/yXDoankutY8,并开始挖掘HTML错误。
检查CSS和HTML是否都有效。我使用Tidy函数来修复我的HTML并删除我的CSS,一点一点地重新实现它。
就我而言,这是一个简单的CSS规则:
.views-row {
display: block;
}