Level 75
https://github.com/barryvdh/laravel-dompdf/blob/master/src/PDF.php#L131
4th parameter should be a string not an array.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I installed dompdf and I try output pdf but I see this error.
strtoupper() expects parameter 1 to be string, array given
Controller
public function index()
{
$articles = Article::all();
$pdf = PDF::loadView('articles', compact('articles'),[],[
'mode' => 'utf-8', 'format' => [233,500]
])->save('public/file.pdf');
return $pdf->stream('articles.pdf');
}
@oxbir How I said 4th parameter should be a string, you put there an array ['mode' => 'utf-8']
So
$pdf = PDF::loadView('articles', compact('articles'), [], 'utf-8');
Please or to participate in this conversation.