class.pdf.php第3154行中的ErrorException

时间:2016-05-11 13:23:23

标签: laravel-5.2 dompdf

我是Laravel的新手,我使用laravel 5.2并且我正在尝试使用DomPdf生成报告,但我收到错误:

  

class.pdf.php第3154行中的ErrorException

未定义的索引:

in class.pdf.php line 3154
at HandleExceptions->handleError('8', 'Undefined index: ', 'C:\xampp\htdocs\balai\vendor\dompdf\dompdf\lib\class.pdf.php', '3154', array('size' => '12')) in class.pdf.php line 3154
at Cpdf->getFontHeight('12') in cpdf_adapter.cls.php line 740
at CPDF_Adapter->get_font_height('C:/xampp/htdocs/balai/vendor/dompdf/dompdf/lib/fonts/Times-Roman', '12') in font_metrics.cls.php line 122
at Font_Metrics::get_font_height('C:/xampp/htdocs/balai/vendor/dompdf/dompdf/lib/fonts/Times-Roman', '12') in text_frame_reflower.cls.php line 167
at Text_Frame_Reflower->_layout_line() in text_frame_reflower.cls.php line 332
at Text_Frame_Reflower->reflow(object(Block_Frame_Decorator)) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow(object(Block_Frame_Decorator)) in block_frame_reflower.cls.php line 750
at Block_Frame_Reflower->reflow(null) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow() in page_frame_reflower.cls.php line 123
at Page_Frame_Reflower->reflow(null) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow() in dompdf.cls.php line 973
at DOMPDF->render() in PDF.php line 208
at PDF->render() in PDF.php line 154
at PDF->output() in PDF.php line 166
at PDF->save('documents.pdf') in LlajRambuController.php line 247
at LlajRambuController->printRambu('52', '1')

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,我找到了一个对我没用的解决方案。

我传递给dompdf的HTML没有任何换行符,例如:

<html><body>content here<body></html>

body 标记后添加一个中断修复了问题。

<html><body>
content here
</body></html>

不知道发生了什么,但现在可行了。希望这也解决了你的问题。