98
Views
1
Comments
[Ultimate PDF] Ultimate PDF: font-family not preserved
ultimate-pdf
Reactive icon
Forge asset by Leonardo Fernandes
Application Type
Reactive

I am currently facing an issue with the "font-family" of the resulting document. When moving from the preview (as a web page) to the generated PDF the layout is correctly preserved, but the font-family ("Century Gothic") unfortunately is not.

Browsing the web, it seems to be a common issue when working with html-to-PDF conversions, but I have not found anything directly related to UltimatePDF yet.

Is there any "module-setup" (or parameter) that I am missing? I mean, at the moment I am just expecting UltimatePDF to keep the font inside the template. I am not explicitly passing it as some kind of property.

2019-07-08 11-04-35
Leonardo Fernandes
 
MVP

Hi Davide. See attached an example of how to include a custom font. Century Gothics seems to be a commercial font, but I've used Didact Gothic instead.

If you're embedding the font from an external party (e.g. Google Fonts or a CDN) then you will need to check the CSP (Content Security Policy) settings for your module, and make sure it allows embedding fonts from said external party. However, if that were the case, your browser wouldn't load the font when previewing. In any case, if you can host the font on your server as a resource, it would avoid any eventual CSP issues.

DidactGothic.oml
Didact Gothic.pdf
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.