Fonts and Languages
Font handling is a crucial aspect of PDF generation. When generating PDFs using headless browsers like Puppeteer, the required fonts must be installed in the environment. pdfg comes with a rich set of pre-installed fonts and allows you to easily add custom fonts that aren't included.
Supported Fonts and Languages
Built-in Fonts
pdfg supports many fonts centered around the Noto font family.
Each font typically comes with Bold 600
and Regular 400
styles.
NotoEmoji-Regular.ttf NotoSansJP-Bold.ttf NotoSansThai-Bold.ttf NotoSerifJP-Regular.ttf
NotoKufiArabic-Bold.ttf NotoSansJP-ExtraBold.ttf NotoSansThai-Regular.ttf NotoSerifJP-SemiBold.ttf
NotoKufiArabic-Regular.ttf NotoSansJP-ExtraLight.ttf NotoSerif-Bold.ttf NotoSerifKR-Bold.ttf
NotoNaskhArabic-Bold.ttf NotoSansJP-Light.ttf NotoSerif-Regular.ttf NotoSerifKR-Regular.ttf
NotoNaskhArabic-Regular.ttf NotoSansJP-Medium.ttf NotoSerifBengali-Bold.ttf NotoSerifSC-Regular.ttf
NotoSans-Bold.ttf NotoSansJP-Regular.ttf NotoSerifBengali-Regular.ttf NotoSerifTC-Regular.ttf
NotoSans-Regular.ttf NotoSansJP-SemiBold.ttf NotoSerifJP-Black.ttf NotoSerifThai-Bold.ttf
NotoSansArabic-Bold.ttf NotoSansJP-Thin.ttf NotoSerifJP-Bold.ttf NotoSerifThai-Regular.ttf
NotoSansArabic-Regular.ttf NotoSansKR-Bold.ttf NotoSerifJP-ExtraBold.ttf Roboto-Bold.ttf
NotoSansBengali-Bold.ttf NotoSansKR-Regular.ttf NotoSerifJP-ExtraLight.ttf Roboto-Regular.ttf
NotoSansBengali-Regular.ttf NotoSansSC-Regular.ttf NotoSerifJP-Light.ttf
NotoSansJP-Black.ttf NotoSansTC-Regular.ttf NotoSerifJP-Medium.ttf
Here's a list of languages supported by these fonts:
Supported Languages
1. European Languages
English / French / German / Italian / Spanish / Portuguese / Dutch / Danish / Swedish / Norwegian / Finnish / Icelandic / Estonian / Latvian / Lithuanian / Polish / Czech / Slovak / Hungarian / Romanian / Turkish / Croatian / Serbian / Bulgarian / Albanian / Greek
2. Cyrillic Script Languages
Russian / Ukrainian / Belarusian / Kazakh / Kyrgyz / Mongolian (Cyrillic) / Tajik
3. East Asian Languages
Japanese / Chinese (Simplified) / Chinese (Traditional) / Korean
4. Southeast Asian Languages
Thai / Vietnamese / Indonesian / Malay / Tagalog (Filipino)
5. South Asian Languages
Bengali / Hindi / Gujarati / Punjabi / Tamil / Telugu / Kannada / Malayalam / Sinhala
6. Middle Eastern & Arabic Languages
Arabic / Persian / Urdu / Hebrew
7. African Languages
Swahili / Amharic / Hausa / Yoruba / Igbo / Zulu
8. Native American Languages
Cherokee / Other Indigenous Languages
9. Others
Esperanto / Emoji
Using Custom Fonts
If you need to use fonts for unsupported languages or want to use different fonts, you can upload custom fonts through the dashboard. Here's an example using an Armenian font:
1. Upload the Font
Upload a font file (e.g., .ttf
) from the dashboard.
2. Specify the Font in HTML
Use @font-face
within the style
tag to specify the font:
<!DOCTYPE html>
<html lang="hy">
<head>
<style>
@font-face {
font-family: "Noto Sans Armenian";
src: url("NotoSansArmenian-Regular.ttf") format("truetype");
}
body {
font-family: "Noto Sans Armenian";
}
</style>
</head>
<body>
<h1>Բարև աշխարհ</h1>
</body>
</html>