Open JulieVelghe opened 5 months ago
I wouldn't recommend using self-hosted fonts for PDFs, and I believe there's performance hits with DomPDF in doing so. You should also use inline CSS in the PDF's Twig template, not a separate CSS file.
You may also need the isRemoteEnabled => true
config setting as well. You might want to Google around for DomPDF and using custom fonts.
Question
Hello, for a clients website, we would like to be be able to style the generated pdf's with a custom font. For our pdf settings (in wishlist.php), we have the following settings: // PDF 'pdfFilenameFormat' => 'karakters-{id}', 'pdfPath' => '_pdf/template', 'pdfAllowRemoteImages' => true, 'pdfPaperSize' => 'A4', 'pdfPaperOrientation' => 'portrait',
in our template twig file we have for example this code: @font-face { font-family: 'Mona Sans Wide'; font-style: italic; font-weight: 800; src: url({{ "#{currentSite.baseUrl}assets/dist/fonts/Mona-Sans/Mona-Sans-ExtraBoldWideItalic.ttf" }}) format('truetype'); }
and we use a css file like this:
screenshot of our folder structure:
Unfortunately the fonts get ignored. Is there any way to get to use those ttf files?
Additional context
No response