helvetica font not working in wkhtmltopdf

前端 未结 6 1725
渐次进展
渐次进展 2020-12-08 10:37

I have been trying to use Helvetica font while creating the pdf but the font is not reflected back in pdf.

I did some google and found some solutions but none are wo

6条回答
  •  悲&欢浪女
    2020-12-08 10:42

    The easiest way to fix wkhtmltopdf's font problems is to Base64 encode the font (you can use this tool) and include it in your CSS:

    @font-face {
        font-family: 'Helvetica';
        src: url(data:font/truetype;charset=utf-8;base64,AAEAAAATAQA...
    }
    

    This works with all fonts (including Google Fonts), and guarantees cross-platform compatibility across different machines and operating systems.

提交回复
热议问题