I'm writing a function to create and display a pdf file using Dompdf in a Laravel 6 project using PHP 8. I tried with many tutorials and even the official documentation from GitHub for the normal Dompdf version and it's wrapper for Laravel. Here is my pdf generator function code:
private function generate_pdf(){
$html = '
<html>
<body>
<h1>Hello Dompdf</h1>
<h2>MDF</h2>
</body>
</html>
';
$pdf = PDF::loadHTML($html);
return $pdf->stream('welcome.pdf');
}
It works fine but here is the result of the function:
As you can see the elements are overlapping itself on top of each others. I looked for answers but I can't find anything related. Does somebody knows why is this happening?
