Puppeteer PDF fonts in Docker
Tested: Puppeteer 25.16.0 with chrome-headless-shell 156 on node:22-bookworm-slim (Debian 12), 2026-11-04
Short answer: a slim Docker image has no fonts, and Chrome won't warn you. Install fontconfig and the fonts you need in one line:
RUN apt-get update && apt-get install -y --no-install-recommends \
fontconfig fonts-liberation fonts-noto-color-emoji fonts-noto-cjk fonts-noto-core \
&& rm -rf /var/lib/apt/lists/*
fonts-liberation stands in for Arial, Times New Roman and Courier New. The Noto packages add emoji, Chinese, Japanese and Korean, and scripts such as Hindi and Thai. Leave out the ones your documents don't need, but keep fontconfig, for the reason below.
See the fonts on a real PDF, with nothing to install: make the fonts and languages sample in the try-it box.
What we tested
We built images from node:22-bookworm-slim with Chrome's system libraries and puppeteer 25.16.0, then printed the same 20 lines in each one: Arial, Helvetica, Times New Roman, Courier New, Georgia, Inter, Lato, the generic families, currency symbols, emoji, Chinese, Japanese, Korean, Cyrillic, Greek, Arabic, Hindi and Thai.
| Installed on top of Chrome's libraries | What the PDF showed |
|---|---|
| Nothing | A blank page. No text at all, not even English, and no error. There was no text to copy out of the PDF either. |
fontconfig only |
Every line in DejaVu. Latin, Cyrillic, Greek and Arabic printed. Emoji, Chinese, Japanese, Korean, Hindi and Thai were empty boxes. |
fontconfig fonts-liberation |
Arial and Helvetica in Liberation Sans, Times New Roman and Georgia in Liberation Serif, Courier New in Liberation Mono. Latin, Cyrillic and Greek printed. Emoji, the ✓ sign and the other scripts were empty boxes. |
plus fonts-noto-color-emoji |
Emoji in colour. |
plus fonts-noto-cjk |
Chinese, Japanese and Korean. |
plus fonts-noto-core |
Arabic, Hindi and Thai in Noto. |
Liberation Sans, Serif and Mono are made to match the character widths of Arial, Times New Roman and Courier New, which is why they're the usual stand-ins.
Don't skip fontconfig
--no-install-recommends keeps an image small, and none of the Debian font packages depend on or recommend fontconfig. So it's easy to end up with fonts but no fontconfig configuration, which is what tells Chrome that Arial means Liberation Sans. Without it:
- With
fonts-liberationalone, every line came out in Liberation Mono, including Arial and Times New Roman. - With all four font packages, every line came out in Noto Sans CJK JP, a Japanese font. That included text set in
monospace, which lost its fixed width.
Those images had no /etc/fonts folder at all. Adding fontconfig to the same apt-get install line fixed both.
Fonts you haven't installed fall back without a warning
Inter and Lato weren't in any of our images, and our test asked for them with no fallback: font-family: Inter. Chrome printed them in its default font, Liberation Serif, so a page designed in a sans-serif came out in a serif.
- End every font list with a generic family. With
font-family: Inter, sans-serif, the same image printed Liberation Sans, which is at least the right style. - To get the real font, install it (below) or load it with
@font-face. If you load it withpage.setContent(), relative font URLs don't resolve. Our Vercel guide covers that, and embedding fonts as base64.
Adding your own font files
Copy them into a font folder in the image:
COPY fonts/*.ttf /usr/local/share/fonts/
Chrome found a font copied there whether or not we ran fc-cache -f afterwards. In CSS, use the font's family name (Lato), not the file name (Lato-Regular.ttf).
Checking what you got
fc-match Arial # LiberationSans-Regular.ttf: "Liberation Sans" "Regular"
pdffonts invoice.pdf # from poppler-utils: the fonts embedded in the PDF
Neither is the whole story:
fc-matchneeds thefontconfigpackage, and it doesn't always agree with Chrome. It answered "Noto Sans" for Inter, but Chrome printed Inter text in Liberation Serif.pdffontsnames most fonts, but Chrome embeds colour emoji and CJK fonts as Type 3 fonts, which it lists as[none].
The surest check is to print a page with every script and style you use, then look at it.
What the fonts cost
Image size on disk, from docker images:
| Image | Size |
|---|---|
| Chrome and its libraries, no fonts | 845 MB |
plus fontconfig fonts-liberation |
855 MB |
plus fonts-noto-color-emoji |
877 MB |
plus fonts-noto-cjk instead |
1.02 GB |
| All five packages | 1.11 GB |
The CJK fonts are most of the cost. If your documents only use Latin, Cyrillic and Greek text, fontconfig fonts-liberation fonts-noto-color-emoji is enough.
On Lambda or Vercel?
Serverless functions have no apt-get, and @sparticuz/chromium ships one font of its own. Puppeteer PDFs on Vercel covers what it prints and how to bring your own fonts.