Open cdaecke opened 3 years ago
Same problem here. Pls help , how can I add my own font? It's not working this way.
Found a (temporary) solution:
Because web2pdf is using mpdf, a possible way to change the font-family is by copying a mpdf-font and putting it into the EXT:web2pdf/Resources/Public/Fonts/
folder with all available options (italic, bold, bolditalic etc.). Then set the font-family in your Print.css (I tested with FreeSans):
h2 {
margin-top: 10mm;
font-family: FreeSans;
}
Available fonts can be found in vendor/mpdf/mpdf/ttfonts/
. Unfortunately and afaik any other fonts won't work (e.g. icomoon).
This works with TYPO3 v10.4.18 and web2pdf v2.0.3 (composer and latest)
I had an earlier version running and struggled with the actual. Solved by adding in the web2pdf\Resources\Private\Libraries\vendor\mpdf\mpdf\src\Config\FontVariables.php under 'fontdata' possibly at the end
about line 153 after "freemono" for example
"futura-pt" => [ 'R' => "TT0138xxx.TTF", 'I' => "TT0139xxx.TTF", 'B' => "TT0144xxx.TTF", 'BI' => "TT0145xxx.TTF", ],
The above named fonts must be in the already mentioned folder EXT:web2pdf/Resources/Public/Fonts/. Good luck!
I'm having trouble again with this issue and my workaround from 5th Aug 2021 doesn't seem to work for me anymore.
Any chance to use custom fonts right now?
Thanks a lot for sharing your extension!
I am trying to use some custom font in generated PDF files. This is my CSS definition:
The font file is located in
EXT:web2pdf/Resources/Public/Fonts/
. The file is namedDINWeb.ttf
.Unfortunately the font is not used for
<div class="teaser">Test</div>
.Am I missing something?
TYPO3: v10.4.8 ext:web2pdf: v 2.0.1