mPDF 5.7.1 - image displays as a broken [x]

后端 未结 11 1288
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 05:59

I have a small issue with mPDF (version 5.7.1).

This code should generate PDF with image file:

 $mpdf = new mPDF();
 $html = \'

        
11条回答
  •  北荒
    北荒 (楼主)
    2020-12-29 06:18

    Ok. After the last comment on question (14:30). Here the exact same code that IS working with mPDF 5.4. And it saves it's output on scripts directory as test.pdf. Firewall issues?

    Edited

    I have the following directories / files:

    • images
      • wallpaper01.jpg
      • wallpaper02.jpg
    • index.php (source code)

    So these image files are relatively starting from the script directory as it looks like.

    require_once __DIR__ . DIRECTORY_SEPARATOR . 'MPDF/mpdf.php';
    
    try {
        $mpdf = new mPDF(); 
        $mpdf->WriteHTML('');
        $mpdf->WriteHTML('');
        $mpdf->Output(__DIR__ . DIRECTORY_SEPARATOR . 'test.pdf', 'F');
    } catch(Exception $e) {
        echo $e;
    }
    

    Fully working example (download)

提交回复
热议问题