Replies: 9 comments 4 replies
-
I have the same problem |
Beta Was this translation helpful? Give feedback.
-
Does anyone has found a solution for this? |
Beta Was this translation helpful? Give feedback.
-
@thibodelanghe @Retropartidas @ahoiroman
Maybe this type of issue should be documented somewhere here. |
Beta Was this translation helpful? Give feedback.
-
We has success using this tool to get the base64 version of the font right in the CSS. |
Beta Was this translation helpful? Give feedback.
-
Bumping this back to the top… Any progress anywhere on this issue? My use case is more or less the same as in the question, except for two things:
When I trace the requests, I get local paths, not HTTP requests:
I can’t really tell for sure if the file request actually succeeds, but replacing Yet no fonts embedded in the PDF. |
Beta Was this translation helpful? Give feedback.
-
I have had great success with including css and font with the An example of how I use a layout for both normal render ($isPreview) and for the PDF: @if($isPreview)
<link href="{{ mix('css/app.css') }}" rel="stylesheet" />
<link href="{{ asset('css/fontawesome.min.css') }}" rel="stylesheet" />
<link href="{{ asset('css/light.min.css') }}" rel="stylesheet" />
@else
<link href="{{ public_path('css/app.css') }}" rel="stylesheet" />
<link href="{{ public_path('css/fontawesome.min.css') }}" rel="stylesheet" />
<link href="{{ public_path('css/light.min.css') }}" rel="stylesheet" />
<style>
@font-face {
font-family: "Optima LT Pro";
src: url("{{ public_path('/webfonts/OptimaLTPro-Roman.woff2') }}") format("woff2"),
url("{{ public_path('/webfonts/OptimaLTPro-Roman.woff') }}") format("woff");
font-weight: normal;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Optima LT Pro";
src: url("{{ public_path('/webfonts/OptimaLTPro-Italic.woff2') }}") format("woff2"),
url("{{ public_path('/webfonts/OptimaLTPro-Italic.woff') }}") format("woff");
font-weight: normal;
font-style: italic;
font-display: swap;
}
</style>
@endif Notice how I use it for both the .css and for the url to the .woff. |
Beta Was this translation helpful? Give feedback.
-
@Joel-Jensen What does this do to your file size? I am having issues with fonts loading, and when I base64 encode them to include in my CSS, my PDF jumps from 3MB to 45MB. |
Beta Was this translation helpful? Give feedback.
-
I have a line in my blade that reads |
Beta Was this translation helpful? Give feedback.
-
This is the only thing that solved it for me:
|
Beta Was this translation helpful? Give feedback.
-
Hello there,
I got a an issue:
This is my blade-template that is being rendered:
app.css
contains@font-faces
like:Now if I try to create a pdf, those fonts are not loaded correctly.
If I trace that down using:
I see those requests:
I am able to open this path using my browser and the virtual machine Laravel lives in, is able to do so, too:
But the fonts are still not applied.
Now if I simply use Google fonts like this
it works just fine.
So what did I do wrong?
Beta Was this translation helpful? Give feedback.
All reactions