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

luismabenitez's avatar

DomPDF fonts with Serverless / Vapor

Anybody is using DomPDF custom fonts with Laravel Vapor? The fonts are not rendered.

The style inside the blade file is:

<style>
    @font-face{
        font-family: bebas;
        src: url({{storage_path('fonts/bebas.ttf')}}) format("truetype");
        font-weight: normal;
    }
</style>

I tried added into the controller a custom cache dir to /tmp, like this:

$options = ['fontCache' => '/tmp/','isRemoteEnabled' => true,'isFontSubsettingEnabled' => true];

But it doesn't works. Having the times default font.

0 likes
2 replies
bait-dept's avatar

I believe you've to publish your assets to the public folder and load them from there.

I think it was the way I did it when dealing with DomPDF and Vapor.

Please or to participate in this conversation.