MPDF undefined index error

Red picture Red · Nov 10, 2012 · Viewed 17.3k times · Source

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.

Answer

Heer Makwana picture Heer Makwana · Mar 29, 2013

Add following at top of mpdf.php

error_reporting(0); 

This will resolved the issue.