Create dynamic font bundles for Nutrient PDF SDK
npm install @nutrient-sdk/font-toolGenerate fonts.json metadata for Nutrient PDF SDK font bundles.
š Guide: Dynamic Font Loading in Nutrient Web SDK
``bashRun directly (no install needed)
npx @nutrient-sdk/font-tool create ./my-fonts
Usage
`bash
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.jsonPretty-print the JSON
nutrient-font-tool create ./my-fonts --pretty
`The tool recursively scans the input directory for font files.
$3
| Option | Description |
|--------|-------------|
|
-o, --output | Output file (default: ) |
| --pretty | Pretty-print JSON output |Supported Formats
-
.ttf - TrueType
- .otf - OpenType
- .ttc - TrueType Collection
- .otc - OpenType CollectionOutput
Generates a
fonts.json file with font metadata:`json
{
"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