Repository navigation
Fonts
huzpsb edited this page Oct 25, 2026
·
1 revision
List supported fonts, install TrueType fonts/collections for stamps and watermarks, and create font cheat sheets.
pdfcpu2 fonts list # built-in (14 core fonts) + installed user fonts
pdfcpu2 fonts install my-font.ttf # .ttf and .ttc
pdfcpu2 fonts install a.ttf b.ttf c.ttf
pdfcpu2 fonts cheatsheet # cheat sheet PDFs for user fonts
pdfcpu2 fonts cheatsheet my-font.ttf # specific fontInstalled fonts become available to stamp / watermark / create by name (font: MyFont). Core fonts: Helvetica, Times, Courier (+ bold/italic variants), Symbol, ZapfDingbats — always available, never embedded.
CJK tip: stamp/watermark support script: names (Hans, Hant, Hira, Kana, Jpan, Hang, Kore) that render via CID system fonts without embedding large font files — see Stamp.
package main
import (
"context"
"fmt"
"github.com/huzpsb/pdfcpu2/pkg/api"
)
func main() {
ss, err := api.ListFonts(context.Background())
if err != nil {
panic(err)
}
for _, s := range ss {
fmt.Println(s)
}
// Install user fonts into the config dir
if err := api.InstallFonts(context.Background(), []string{"my-font.ttf"}); err != nil {
panic(err)
}
// Generate cheat sheet PDFs for user fonts
if err := api.CreateUserFontCheatSheets(context.Background(), ".", "my-font.ttf"); err != nil {
panic(err)
}
}Result-reporting variants: api.InstallFontsWithResult, api.CreateUserFontCheatSheetsWithResult.
pdfcpu2 wiki
Getting started
Fork features
Inspect
Document
Pages
Content
Extract
Resources
Security
Viewer
Trust
Developers