Support adding the watermark on export PDF https://github.com/siyuan-note/siyuan/issues/9961

This commit is contained in:
Daniel 2023-12-27 11:32:48 +08:00
parent 44a1d9a233
commit efac191a82
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -863,7 +863,7 @@ func processPDFWatermark(pdfCtx *pdfcpu.Context, watermark bool) {
m[kv[0]] = kv[1]
}
if "" == m["fontname"] {
m["fontname"] = "LXGW WenKai Lite"
m["fontname"] = "LXGWWenKaiLite-Regular"
}
descBuilder := bytes.Buffer{}
for k, v := range m {
@ -874,19 +874,12 @@ func processPDFWatermark(pdfCtx *pdfcpu.Context, watermark bool) {
}
desc = descBuilder.String()
desc = desc[:len(desc)-1]
fontPath := filepath.Join(util.AppearancePath, "fonts", "LxgwWenKai-Lite-1.311", "LXGWWenKaiLite-Regular.ttf")
err := api.InstallFonts([]string{fontPath})
if nil != err {
logging.LogErrorf("install font [%s] failed: %s", fontPath, err)
}
fonts, err := api.ListFonts()
if nil != err {
logging.LogErrorf("list fonts failed: %s", err)
} else {
for _, f := range fonts {
logging.LogInfof("installed font: %s", f)
}
}
mode := "text"
if gulu.File.IsExist(str) {