是否有可能在带有中文字母的weasyprint中生成pdf文件?

时间:2020-01-09 14:32:07

标签: python linux weasyprint

我有这样的html代码:

<head><meta charset="UTF-8"></head><h1>德德德</h1>

我希望使用weasyprint将其转换为pdf,但是当我打开生成的文件时,我得到:

5FB7 5FB7 5FB7

在矩形中。

我不知道我在做什么错。

当我尝试使用以下代码加载自定义字体时:

    css = CSS(string='''
          @font-face {
          font-family: 'fonts-japanese-gothic';
          src: url('/share/fonts/truetype/unfonts-core/UnDotum.ttf') format('truetype');
                     }
''', font_config=font)

我遇到了这样的错误:

Ignored `src: url("/share/fonts/truetype/unfonts-core/UnDotum.ttf") format("truetype")` at 3:3, Relative URI reference without a base URI: '/share/fonts/truetype/unfonts-core/UnDotum.ttf'.

0 个答案:

没有答案