Hi
I don't have a solution to your problem. But there's a package from Spatie which you could use instead. It has a nice API and is easy to use.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I feel like im going insane, I have imported chrome-php into my laravel application. I want to
But i cant seem to get any of my CSS styles to render even if they are inline (ie not using blade partials).
This is my code, am i doing something wrong? I can get images to render fine, just not CSS is applied excelt like font-weight bold, its very, very odd. I have logged my $html and i see valid HTML with all my blade components and all my css is directly accessible
eg
<link rel="stylesheet" href="https://app.mydomain.com/assets/css/form.css">
$html = view('forms.pdf', ['data' => $data])->render();
try {
$page = $browser->createPage();
$page->setHtml($html);
$pdf = $page->pdf(['printBackground' => true]);
$pdf->saveToFile($pdfFullPath);
} finally {
// Always ensure that the browser is closed
$browser->close();
}
Any ideas?
Please or to participate in this conversation.