Fonts

How to add and use Custom Fonts

This documentation shows you how to add and use custom fonts.

Gotenberg

To add more fonts for Gotenberg, you have to build a Docker Image and distribute it.

Ref: https://gotenberg.dev/docs/customize/fonts

FROM gotenberg/gotenberg:7

USER root

COPY /local/path/to/{font}.ttf /usr/local/share/fonts/{font}.ttf

USER gotenberg

WkHtmlToPdf

WkHtmlToPdf will use the fonts from the server (Linux or Windows).

Alternatively, you can use the <link href="font-url" /> (require internet connection)

mPDF

You can use the "Fonts" from Console UI to fonts, then set metadata to use the custom font:

// metadata
{
  "custom-fonts": ["font-key-1", "font-key-2"]
}

// from your template
<style>
* {
  font-family: "font-key";
}
</style>

Note: mPDF only supports .tff fonts

Last updated