Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hanisirfan's avatar

Loading Assets For Laravel DOMPDF Usage

Can't load images or files from the public route of the app using asset() helper. I'm creating the PDF with the loadView() method. The view itself renders perfectly but the images and font files not being able to be embedded into the PDF.

The images is a background image of a div element being loaded with asset() helper for example {{ asset('storage' . $eventData->logo_first) }} (the file is located in the /storage route). Here is the example of the output from the asset() helper: background: url(my local host/storage/img/logo/1630132239-SeaJell-Logo.png).

Because of this, fonts also aren't being able to be loaded for the @font-face rule that I've set in CSS. I've also referenced all the .ttf file to a public route specifically /fonts route. I've also tried to access the image and font route and it works fine.

I've also tried by loading a random image from Wikipedia using the img element and it works fine.

0 likes
3 replies
GdS's avatar

I agree with @ghabe, try inlining contents with Vite::content("path/to/resource")

Please or to participate in this conversation.