我是Laravel的新手,我使用Laravel5.2,我试图用DomPdf生成一个报告,但是我得到了错误:
ErrorException在class.pdf.php第3154行
未定义索引:
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')发布于 2016-06-20 19:55:28
我也遇到了同样的问题,我找到了一个对我来说毫无意义的解决方案。
我传递给dompdf的HTML没有任何换行符,比如:
<html><body>content here<body></html>在body标记修复问题后添加一个中断。
<html><body>
content here
</body></html>不知道发生了什么,但现在起作用了。希望这也能解决你的问题。
https://stackoverflow.com/questions/37164050
复制相似问题