MPDF undefined index error MPDF undefined index error codeigniter codeigniter

MPDF undefined index error


Add following at top of mpdf.php

error_reporting(0); 

This will resolved the issue.


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.


Still found no real solution (has anyone?). As a workaround, I patched mpdf.php directly in nearly 20 places.

Before:

$variable[possible_wrong_index];

After:

(isset($variable[possible_wrong_index]))?$variable[possible_wrong_index]:false;

There are some if-statements, which were trickier. But now I have no errors in the log and the generated pdf seems to be no affected by this.

(I'm aware that this is a hacky workaround, but it works for the moment - the real fun starts with updates of mpdf :)