You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I can't get custom fonts working. They’re in the public directory (eg. /public/fonts/Inter-Regular.ttf) which is an allowed directory as in the default configuration:
Most likely there is an issue with the path mapping. Sadly the Laravel plugin does "swallow" those warnings at the moment. If you can xdebug into it, checkout \Typesetsh\LaravelWrapper\Typesetsh::render() and check the $this->uriResolver->errors after html2pdf->render is called.
Since its its properly relative to your project root, you can try to do:
@font-face {
font-family:"Inter";
src:url("./fonts/Inter-Regular.ttf") format("ttf");
/* I also tried src: url("/fonts/Inter-Regular.ttf") format("ttf"); */font-weight:400;
}
Ok so setting 'base_dir' => public_path() actually helped. When using @font-face directly inside the HTML head, I could declare the path as ./fonts/.... Also, when using an external stylesheet, I have to set it as ../fonts/.... Which makes sense of course, but I just realised that now. That also means that I didn’t really have to mess with the configuration in the first place, sorry about that.
One note though: my .ttf font still doesn’t work, but my .woff does. It’s not really a problem for me though 😉
Hi, I can't get custom fonts working. They’re in the public directory (eg.
/public/fonts/Inter-Regular.ttf
) which is an allowed directory as in the default configuration:In my CSS I've set the following:
But I had no luck. I also tried using .woff. Do you have any idea what the problem could be?
PS: I love your package! ❤️
The text was updated successfully, but these errors were encountered: