Issue Summary:
When generating PDFs and opening them via Adobe Acrobat Pro on macOS, certain text content was not displaying properly. This issue was traced back to unsupported or improperly embedded web fonts, particularly WOFF/WOFF2, which are not supported for embedding in PDFs on macOS.Key Findings & Root Cause:
macOS does not embed WOFF/WOFF2 in PDFs.
Adobe Acrobat Pro has inconsistent rendering with web fonts.
Some fonts like "Exo 2" from Google Fonts fail to render unless properly converted and embedded.
macOS-Compatible Font Formats:
Font Format | Extension | Supported | Embeds in PDF |
---|---|---|---|
TrueType | .ttf |
✅ | ✅ |
OpenType | .otf |
✅ | ✅ |
AAT / DFTT | .dfont |
✅ | ✅ |
WOFF/WOFF2 | .woff / .woff2 |
⚠️ Web only | ❌ |
System Fonts Pre-Installed in macOS:
Sans-serif: Helvetica, Arial, SF Pro
Serif: Times New Roman, Georgia, Palatino
Monospace: Courier New, Menlo
Solutions & Best Practices:
Use widely supported fonts: Arial, Verdana, Helvetica, SF Pro.
Convert WOFF/WOFF2 fonts to
.ttf
or.otf
formats before PDF generation.Use @font-face with local font files:
@font-face { font-family: 'Exo 2'; src: url('/fonts/Exo2-Regular.ttf') format('truetype'); }
In Puppeteer: Set
embedFonts: true
, ensure fonts are loaded beforepage.pdf()
is called.For critical compatibility, prefer Arial or Verdana in TrueType format.
Resolution Achieved:
Switching to Verdana in TrueType format (.ttf) and ensuring it was properly embedded in the PDF resolved the issue across macOS devices and Adobe Acrobat Pro.
Paging layout issues with Verdana were noted but considered minor and fixable.
No comments:
Post a Comment