Open amenk opened 4 years ago
@amenk Hey, I‘m pretty sure this is an issue of mpdf. Can you provide some faulty HTML that leads to the crashes on your side?
<ul><div><li>Test</li></div></ul>
But I did not yet verify this as isolated example
Steps to reproduce in a fresh Laravel 7.12 project, with laravel-pdf ^4.0
user@computer:~/example/projects$ composer create-project --prefer-dist laravel/laravel laravel- pdf-test
Creating a "laravel/laravel" project at "./laravel-pdf-test"
Installing laravel/laravel (v7.12.0)
...
user@computer:~/example/projects$ composer require niklasravnsborg/laravel-pdf
Using version ^4.0 for niklasravnsborg/laravel-pdf
...
now replace resources/views/welcome.blade.php
with
<ul><div><li>Test</li></div></ul>
replace routes/web.php
with
<?php
use Illuminate\Support\Facades\Route;
use PDF;
Route::get('/', function () {
$pdf = PDF::loadView('welcome', []);
return $pdf->stream('document.pdf');
});
Open /
This is thrown
ErrorException
Undefined index: list_style_type
At MPDF they claim this is just a notice and not a crash, but when using in Laravel-PDF, it crashes.
Might be because of Laravel's error reporting levels?
@niklasravnsborg How shall we proceed here? Can we catch the exception somehow?
Unfortunately I'm currently not available to investigate further. Maybe you find the cause and provide a fix via pull request?
Niklas
The same thing happens to me in Yii2, I'm desperate, I can't find the solution, the worst thing is that there is no literature in the wen about this. I'm sure it's a Mpdf bug.
This has given me a bit of a hiccup. I'm using a WYSIWYG editor to allow users to edit chapter text. The resulting content is wrapped in a div, and I believe the user can add divs, also.
Chapters are presented to the end-user enumerated; <ol>
is the easiest way to get automatic numbering. After finding out that divs in ol tags are not allowed, I tried switching to css counter, but it appears that mpdf doesn't recognize css counter properties.
Finally I settled on adding the count to the content itself. This would seem to break the principle of separating content from presentation.
I'm facing the same issue but for Undefined Index : SELECT
I used hex color (#d1d5db)
instead of rgb(209 213 219 / var(--tw-bg-opacity))
and fixed this error
Describe the bug
Upon certain HTML, MPDF generates a notice (see https://github.com/mpdf/mpdf/issues/853 ) which seems to lead to crashes.
To Reproduce
Expected behavior PDF is still generated, even in case of not 100% valid HTML
Not sure if this an issue of Laravel-PDF or MPDF. Feedback welcome how to solve this properly. Maybe we just have to lower the error reporting level?