Problem
When saving pages as MHTML using Chromium (including via Playwright or CDP's Page.captureSnapshot), web fonts are frequently missing from the archive. The @font-face declarations in CSS reference font files by URL path, but the actual font binaries are not included as MIME parts.
Root cause
This is a known, long-standing Chromium bug: chromium issue 40219015
Chromium's FrameSerializer has code to embed fonts (AddFontToResources()), but it checks font.IsLoaded() and font.ResourceBuffer() at save time. If a font was lazily loaded or has been evicted from the resource cache, it is silently skipped. There is no Chrome flag or setting to control this behavior.
Workarounds
- Ensuring all fonts are fully loaded before saving (e.g., using
document.fonts.ready in Playwright) may improve results, but is not guaranteed.
- SingleFile (browser extension) actively fetches and embeds all resources including fonts, but is not usable in headless/Playwright workflows.
References
Problem
When saving pages as MHTML using Chromium (including via Playwright or CDP's
Page.captureSnapshot), web fonts are frequently missing from the archive. The@font-facedeclarations in CSS reference font files by URL path, but the actual font binaries are not included as MIME parts.Root cause
This is a known, long-standing Chromium bug: chromium issue 40219015
Chromium's
FrameSerializerhas code to embed fonts (AddFontToResources()), but it checksfont.IsLoaded()andfont.ResourceBuffer()at save time. If a font was lazily loaded or has been evicted from the resource cache, it is silently skipped. There is no Chrome flag or setting to control this behavior.Workarounds
document.fonts.readyin Playwright) may improve results, but is not guaranteed.References