简体   繁体   中英

support in non latin fonts in centos

I'm trying to enable export html to pdf in my language (Hebrew). The html and export work fine on my local machine (Mac).

I'm using https://github.com/wkhtmltopdf/

On the remote machine(Centos7) The html works with the Hebrew fonts but the export to pdf outputs this

PDF输出

I've tried following:
1.

<head>
    <meta name="pdfkit-page-size" content="Legal"/>
    <link rel="stylesheet" href="/static/webapp/plugins/manual/pdf.css">
    <meta charset="UTF-8">
</head>
  1. sudo yum install curl cabextract xorg-x11-font-utils fontconfig
  2. sudo yum install liberation-sans-fonts
  3. sudo yum install dejavu-lgc-sans-fonts (from: https://gist.github.com/drakakisgeo/7591660 )

None worked.

The output of locale

[my_user@ip-172-31-34-70 ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

Any suggestions?

The answer is that the remote server didn't have the right fonts.

I have also solved this by just copying Arial.ttf from my local mac in /Library/Fonts

scp -i "$STAGING_CERT_PATH" Arial.ttf root@"$STAGING_IP":/usr/share/fonts/local/

to my remote server to /usr/share/fonts/local (created the local dir myself).

then fc-cache -v to update and it worked

试试这个一个yum install cjkuni-uming-fonts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM