mPDF Manual – Troubleshooting

Blank screen

If you get nothing but a blank screen on your browser, it may be because there is a script error. Turn on debugging at the start of your script:

// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';

try {
    $mpdf = new \Mpdf\Mpdf();
    $mpdf->debug = true;
    $mpdf->WriteHTML("Hello World");
} catch (\Mpdf\MpdfException $e) { // Note: safer fully qualified exception 
                                   //       name used for catch
    // Process the exception, log, print etc.
    echo $e->getMessage();

See also Known issues and Corrupt PDF file.

localhost problems / Vista 64 bit

Since updating to Windows Vistax64bit for development, all files containing images or external stylesheets crashed or timeout.

See the useful thread at,28291

To generate images and retrieve external stylesheets, mPDF needs to access files using fopen() etc. Changing localhost to resolved the problem.

Generating graphs with JPGraph

JPGraph outputs error messages as images generated by the script. If the error message is “out of memory” then you just get a blank screen. Try increasing your memory_limit.

Fork me on GitHub