Philipp Weber Philipp Weber - 14 days ago 7
PHP Question

MPDF show empty Page after Update from 5.7 to 6.1

i make a php script which gets an url of a website and convert the website to PDF. This works fine with MPDF version 5.7. I want to upgrade my MPDf to version 6.1 because the version interprets the

  • tag better. I update my fonts and now if i try to execute the script i get an empty Page.

    New Code:
    ob_start();
    include(substr($url, 1, strlen($url)-1));
    $html=ob_get_contents();
    ob_end_clean();
    require_once("mpdf61/mpdf.php");
    $mpdf = new mPDF('', 'A4', 8,'roboto');
    $mpdf->SetFooter('W&T||Seite {PAGENO}');
    $mpdf->SetHTMLHeader('<div style="text-align: right;" ><img style="height:50px;" src="/pics/head/e-logow-01-grww-000.png " ></div>');
    $mpdf->SetAutoPageBreak(true , 15);
    $mpdf->SetTopMargin(30);
    $mpdf->AddPage();
    $mpdf->list_indent_first_level = 0;
    $mpdf->WriteHTML($html);
    $mpdf->Output();


    Old code:
    ob_start();
    include(substr($url, 1, strlen($url)-1));
    $html=ob_get_contents();
    ob_end_clean();
    require_once("mpdf57/mpdf.php");
    $mpdf = new mPDF('', 'A4', 8,'roboto');
    $mpdf->SetFooter('W&T||Seite {PAGENO}');
    $mpdf->SetHTMLHeader('<div style="text-align: right;" ><img style="height:50px;" src="/pics/head/e-logow-01-grww-000.png " ></div>');
    $mpdf->SetAutoPageBreak(true , 15);
    $mpdf->SetTopMargin(30);
    $mpdf->AddPage();
    $mpdf->list_indent_first_level = 0;
    $mpdf->WriteHTML($html);
    $mpdf->Output();


    it is the same code code with another libary version.

  • Answer

    You have to check your PHP version. Check that mpdf is supported or not to your current PHP version.

    Look into this change log file and check If any deprecated function you used or not.

    https://github.com/mpdf/mpdf/blob/v6.1.0/CHANGELOG.txt