Generate fonts.json metadata for Nutrient PDF SDK font bundles.
📖 Guide: Dynamic Font Loading in Nutrient Web SDK
# Run directly (no install needed)
npx @nutrient-sdk/font-tool create ./my-fonts
# Or install globally
npm install -g @nutrient-sdk/font-tool# Generate fonts.json inside the font directory
nutrient-font-tool create ./my-fonts
# → ./my-fonts/fonts.json
# Specify custom output path
nutrient-font-tool create ./my-fonts -o ./output/fonts.json
# Pretty-print the JSON
nutrient-font-tool create ./my-fonts --prettyThe tool recursively scans the input directory for font files.
| Option | Description |
|---|---|
-o, --output <file> |
Output file (default: <input-dir>/fonts.json) |
--pretty |
Pretty-print JSON output |
.ttf- TrueType.otf- OpenType.ttc- TrueType Collection.otc- OpenType Collection
Generates a fonts.json file with font metadata:
{
"v": 1,
"availableFonts": [
{
"name": {
"family": "Noto Sans",
"fullName": "Noto Sans Regular",
"subfamily": "Regular"
},
"filePath": "NotoSans-Regular.ttf",
"codePoints": [[32, 126], [160, 255], ...],
"sha1": "abc123...",
"allowedToEmbed": true,
"weight": 5
}
]
}- Node.js 18+
- Dynamic Font Loading Guide — How to use custom font bundles with Nutrient Web SDK
- Nutrient Web SDK — PDF SDK for web applications
MIT