'MPDF throws undefined array key "boxbottom"
I wanted to use mpdf 8.0.17 but ran into an undefined key error. I couldn't find any solution in their git repo or anywhere else. I got this Undefined array key "boxbottom" message even with the simplest example they provided.
I use laravel 8.65 and I've also tried carlos-meneses/laravel-mpdf 2.1.8 which also uses mpdf 8.0.17 and got the same undefined key message.
This is the simplest example I've tried so far:
$mpdf = new Mpdf([
'tempDir' => __DIR__ . '/test',
]);
$mpdf->WriteHTML('Hello World');
dd($mpdf->Output());
and got this error message:
Undefined array key "boxbottom"
at this line:
vendor/mpdf/mpdf/src/Mpdf.php:11353
$midpoint = $lineBox[-1]['boxbottom'] - (($lineBox[-1]['boxbottom'] - $lineBox[-1]['boxtop']) / 2);
I've also tried to use the WriteHTML method with an empty string like this:
$mpdf->WriteHTML('');
and didn't get any errors, but my pdf file was empty of course.
Also tried the WriteCell function like this:
$mpdf->WriteCell(10, 10, 'test');
which didn't throw any errors, but the pdf file was empty.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
