Mpdf loaded once then not worked [closed]

2019-08-22 19:20发布

问题:

I am currently trying Mpdf, installed it using composer and created a simple code. Here it is

<?php 
require_once 'vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML("<h1 style='color:red'>Hello world!</h1>");
$mpdf->Output();
?>

It successfully loaded once then it doesnt load more. I am loading it via XAMPP. Thankyou so much. Hope someone helps me.

回答1:

Where is the part where it actually writes to a file

for example, this is the html

$html = '<table width="60%" cellspacing="0">
            <thead>
                <tr>
                    <th>Empid</th>
                    <th>Name</th>
                    <th>Salary</th>
                    <th>Age</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                   <td>1</td>
                   <td>Tiger Nixon</td>
                   <td>320800</td>
                   <td>61</td>
                </tr>
            </tbody>
        </table>';

//save the file put which location you need folder/filname
$mpdf->Output("phpflow.pdf", 'F');


//out put in browser below output function
$mpdf->Output();


标签: php mpdf