Prompt
Why is my HTML to PDF output missing fonts?
Latest observation
Oct 12, 2026
OpenAI APIWeb search: off
Fonts usually go missing in HTML-to-PDF output for one of these reasons:
-
The PDF engine can’t access the font files
- The font is loaded from a path or URL the converter can’t reach.
- Relative paths work in the browser but not in the PDF renderer.
- The renderer may need an absolute file path or embedded base64 font.
-
The font is not embedded
- Some tools don’t automatically embed fonts into the PDF.
- If the viewer doesn’t have that font installed, it will fall back to another font or show blank/missing text.
-
CSS
@font-faceis incomplete or incorrect- Missing
font-family,src, or correct format declarations. - Wrong file type for the converter, e.g. WOFF2 unsupported by some engines.
- Example:
@font-face { font-family: 'MyFont'; src: url('/fonts/MyFont.ttf') format('truetype'); }
- Missing
-
The browser renders it, but the PDF tool uses a different engine
- Chrome, wkhtmltopdf, Puppeteer, WeasyPrint, Prince, Playwright, etc. all have different font support.
- A font that works in Chrome might fail in wkhtmltopdf or older headless browsers.
-
Web fonts are blocked or not fully loaded before PDF generation
- If the PDF is generated before the font finishes downloading, fallback fonts are used.
- In browser-based rendering, wait for fonts to load first:
await document.fonts.ready;
-
Font licensing or subsetting issues
- Some PDF generators subset fonts or fail with certain font encodings.
- Rarely, the font itself may be corrupted or unsupported.
Things to check quickly
- Use absolute URLs for fonts.
- Make sure the font format is supported by your converter.
- Confirm the font is loaded before generating the PDF.
- Try embedding the font with
@font-face. - If using a tool like wkhtmltopdf, verify it supports the font format and CSS features you need.
If you want, I can help diagnose your specific setup if you share:
- the HTML/CSS font code,
- the PDF library/tool,
- and whether the font works in the browser but not in the PDF.