dongying6896 2012-11-10 06:41
浏览 221
已采纳

MPDF未定义索引错误

I am using MPDF library to convert HTML to PDF.

Here is my code.

$HTML = '{HTML CONTENT GOES HERE}'; //HTML STRING

$MPDF->WriteHTML($html); // Converting

$MPDF->Output('preview.pdf','F'); //Saving to a File

It works , but generating too much errors in error log ,

ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined index: BODY C:\wamp\www\crm\application\libraries\mpdf.php 14242
ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined index: BODY>>ID>> C:\wamp\www\crm\application\libraries\mpdf.php 14288
ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined offset: -1 C:\wamp\www\crm\application\libraries\mpdf.php 14421
ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined variable: cstr C:\wamp\www\crm\application\libraries\mpdf.php 31951
ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined index: DIV C:\wamp\www\crm\application\libraries\mpdf.php 14242
ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined index: ID>>PRINT_WRAPPER C:\wamp\www\crm\application\libraries\mpdf.php 14280
ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined index: DIV>>CLASS>>PRINTWRAPPER C:\wamp\www\crm\application\libraries\mpdf.php 14284
ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined index: DIV>>ID>>PRINT_WRAPPER C:\wamp\www\crm\application\libraries\mpdf.php 14288
ERROR - 2012-11-10 04:45:50 --> Severity: Notice  --> Undefined index: DIV C:\wamp\www\crm\application\libraries\mpdf.php 14242

anybody have some working experience with this library ? (If it only outputs some errors then we can fix it by changing on the library , but here it gives too much error) , i think that i am missing something.

Please help me.

Thanks.

  • 写回答

5条回答 默认 最新

  • douyue7536 2012-11-10 06:59
    关注

    Is the HTML well formed, and also are all the tags and attributes either all lowercase or all uppercase? Here are the requirements for the HTML as per MPDF documentation:

    Example of an HTML attribute: <div align="center">

    mPDF supports attribute values in single or double quotes e.g. <div align="center"> or <div align='center'>

    Minimised attributes are not supported e.g. <input type="checkbox" disabled />

    XHTML specification is recommended for best compliance with mPDF.

    Also per https://mpdf.github.io/html-support/html-tags.html

    you seem to be using tags that are not supported. BODY for instance is not.

    I would try to limit my HTML to the ones on the documented list and and follow their well formed guidelines and see if the errors get fixed that way. They are only 'notices' so nothing severe, but it would be best to fix them just in case future versions are not as forgiving.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 MATLAB代码补全插值
  • ¥15 Typegoose 中如何使用 arrayFilters 筛选并更新深度嵌套的子文档数组信息
  • ¥15 前后端分离的学习疑问?
  • ¥15 stata实证代码答疑
  • ¥50 husky+jaco2实现在gazebo与rviz中联合仿真
  • ¥15 dpabi预处理报错:Error using y_ExtractROISignal (line 251)
  • ¥15 在虚拟机中配置flume,无法将slave1节点的文件采集到master节点中
  • ¥15 husky+kinova jaco2 仿真
  • ¥15 zigbee终端设备入网失败
  • ¥15 金融监管系统怎么对7+4机构进行监管的