helvetica font not working in wkhtmltopdf

前端 未结 6 1720
渐次进展
渐次进展 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 11:02

    For me loading fonts from Google Fonts didn't work. And putting base64ed binary into a CSS file seems a little to much for me(Korean types are several megabytes). I'd recommend to install the fonts you need to use on the machine. For Ubuntu you can simply download fonts files from Google Fonts and copy the files in to $HOME/.fonts directory and run fc-cache command in command line to rebuild the fonts list.

    $ mkdir ~/.fonts
    $ copy your-font-file.ttf ~/.fonts/
    $ fc-cache -fv
    

    For a Rails application you can symlink

    $ ln -s /your/app/root/assets/fonts ~/.fonts
    

    Then you will be able to list all available fonts.

    $ fc-list
    Nimbus Sans L:style=Regular Italic
    URW Palladio L:style=Roman
    Century Schoolbook L:style=Bold Italic
    Nimbus Sans L:style=Bold
    URW Chancery L:style=Medium Italic
    Nimbus Roman No9 L:style=Regular
    Century Schoolbook L:style=Bold
    Century Schoolbook L:style=Italic
    Nimbus Sans L:style=Regular
    ....
    

提交回复
热议问题