linux下转pdf乱码

在window下用wordxml转pdf没有问题,但是在linux下面就有问题,变成方框经过排查,发现xml里面又很多windows的字体,而linux下面没有,

解决如下:
1.yum -y install fontconfig 进行安装
2.在/usr/shared/fonts目录下新建一个目录chinese
3.C:\Windows\Fonts目录下上传你需要的字体到/usr/share/fonts/chinese目录下

[root@iZjd8471u20gpaZ ~]# cd /usr/share/fonts/
[root@iZjd8471u20gpaZ fonts]# ll
total 8
drwxr-xr-x 2 root root 4096 Jul  8 18:03 chinese
drwxr-xr-x 2 root root 4096 Jun 18 17:42 dejavu
[root@iZjd8471u20gpaZ fonts]# cd chinese
[root@iZjd8471u20gpaZ chinese]# ll
total 96640
-rw-r--r-- 1 root root 16829116 Jul  8 18:04 MSYHBD.TTC
-rw-r--r-- 1 root root 12139380 Jul  8 18:04 MSYHL.TTC
-rw-r--r-- 1 root root 19647736 Jul  8 18:04 MSYH.TTC
-rw-r--r-- 1 root root 10578152 Jul  8 18:04 SIMFANG.TTF
-rw-r--r-- 1 root root  9753388 Jul  8 18:04 SIMHEI.TTF
-rw-r--r-- 1 root root 11787328 Jul  8 18:04 SIMKAI.TTF
-rw-r--r-- 1 root root 18214472 Jul  8 18:04 SIMSUN.TTC
[root@iZjd8471u20gpaZ chinese]#

4.yum -y install ttmkfdir 执行
5.fc-cache刷新
6.fc-list可以看到刚刚的配置了

[root@iZjd8471u20gpaZ chinese]# fc-list
/usr/share/fonts/dejavu/DejaVuSansCondensed-Oblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique
/usr/share/fonts/chinese/MSYH.TTC: Microsoft YaHei:style=Normal
/usr/share/fonts/dejavu/DejaVuSansCondensed-Bold.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold
/usr/share/fonts/chinese/SIMSUN.TTC: SimSun,宋体:style=Regular,常规
/usr/share/X11/fonts/Type1/c0611bt_.pfb: Courier 10 Pitch:style=Bold Italic
/usr/share/fonts/chinese/MSYHBD.TTC: Microsoft YaHei:style=Έντονα
/usr/share/X11/fonts/Type1/UTBI____.pfa: Utopia:style=Bold Italic
/usr/share/X11/fonts/Type1/c0419bt_.pfb: Courier 10 Pitch:style=Regular
/usr/share/fonts/dejavu/DejaVuSans.ttf: DejaVu Sans:style=Book
/usr/share/fonts/chinese/MSYH.TTC: Microsoft YaHei UI:style=Normal
/usr/share/fonts/chinese/MSYHBD.TTC: Microsoft YaHei UI:style=Έντονα
/usr/share/X11/fonts/Type1/c0648bt_.pfb: Bitstream Charter:style=Regular
/usr/share/fonts/chinese/SIMSUN.TTC: NSimSun,新宋体:style=Regular,常规
/usr/share/fonts/chinese/MSYHL.TTC: Microsoft YaHei UI,Microsoft YaHei UI Light:style=Light,Regular
/usr/share/fonts/chinese/SIMKAI.TTF: KaiTi:style=Regular,Normaali
/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: DejaVu Sans:style=Bold
/usr/share/X11/fonts/Type1/cursor.pfa: Cursor:style=Regular
/usr/share/X11/fonts/Type1/UTB_____.pfa: Utopia:style=Bold
/usr/share/X11/fonts/Type1/c0583bt_.pfb: Courier 10 Pitch:style=Bold
/usr/share/X11/fonts/Type1/UTI_____.pfa: Utopia:style=Italic
/usr/share/X11/fonts/Type1/c0582bt_.pfb: Courier 10 Pitch:style=Italic
/usr/share/fonts/dejavu/DejaVuSansCondensed.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed,Book
/usr/share/fonts/dejavu/DejaVuSans-ExtraLight.ttf: DejaVu Sans,DejaVu Sans Light:style=ExtraLight
/usr/share/fonts/chinese/SIMHEI.TTF: SimHei:style=Normal
/usr/share/fonts/dejavu/DejaVuSansCondensed-BoldOblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold Oblique,Bold Oblique
/usr/share/X11/fonts/Type1/c0633bt_.pfb: Bitstream Charter:style=Bold Italic
/usr/share/X11/fonts/Type1/c0649bt_.pfb: Bitstream Charter:style=Italic
/usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf: DejaVu Sans:style=Oblique
/usr/share/X11/fonts/Type1/c0632bt_.pfb: Bitstream Charter:style=Bold
/usr/share/fonts/chinese/SIMFANG.TTF: FangSong:style=Regular,Normaali
/usr/share/fonts/dejavu/DejaVuSans-BoldOblique.ttf: DejaVu Sans:style=Bold Oblique
/usr/share/fonts/chinese/MSYHL.TTC: Microsoft YaHei,Microsoft YaHei Light:style=Light,Regular
/usr/share/X11/fonts/Type1/UTRG____.pfa: Utopia:style=Regular
[root@iZjd8471u20gpaZ chinese]#
posted @ 2020-07-08 20:52  天宇轩-王  阅读(1454)  评论(0编辑  收藏  举报