沈阳网站建设q479185700惠,wordpress登录404,做网站设计好的公司,郴州网站建设公司在哪里Linux下Apose由Word转PDF后乱码问题解决 文章目录 Linux下Apose由Word转PDF后乱码问题解决1. 问题描述2. 问题原因3. 解决方法1. 拷贝Windows中的字体库2. 在Linux中安装字体库 4. 常见问题1. Ubuntu环境下使用如下命令安装#xff1a;2. Centos环境下使用如下命令安装 1. 问题…Linux下Apose由Word转PDF后乱码问题解决 文章目录 Linux下Apose由Word转PDF后乱码问题解决1. 问题描述2. 问题原因3. 解决方法1. 拷贝Windows中的字体库2. 在Linux中安装字体库 4. 常见问题1. Ubuntu环境下使用如下命令安装2. Centos环境下使用如下命令安装 1. 问题描述 在Ubuntu与Centos中使用aspose插件由word转换为PDF时中文显示乱码但是在windows中转换后PDF有中文时显示正常 2. 问题原因 Ubuntu或Centos中缺少对应的中文字体库导致中文出现乱码 3. 解决方法
1. 拷贝Windows中的字体库 将Windows的字体库拷贝到Linux中这里以win10字体库为例进行安装 将Windows10 系统中的 “C:\Windows\Fonts”中的Fonts目录拷贝(大约540MB)一份上传到Linux系统中上传到Linux的目录如“/opt/winFonts” 2. 在Linux中安装字体库
查看Linux中的所有字体
# 查看Linux中的所有字体库
fc-list
# 查看Linux中的中文字体库
fc-list :langzh拷贝与安装字体库
# 1. 在/usr/share/fonts新建 winFonts 目录
cd /usr/share/fonts
sudo mkdir winFonts
# 2. 拷贝从Windows上传的字体库到 /usr/share/fonts/winFonts
sudo cp /opt/winFonts/* /usr/share/fonts/winFonts
# 3.执行安装
cd /usr/share/fonts
# 然后执行以下命令更新字体缓存。
sudo mkfontscale
sudo mkfontdir
sudo fc-cache -fv在centos7中执行fc-cache -fv 看到下面内容说明字体安装成功
[rootlocalhost fonts]# fc-cache -fv
/usr/share/fonts: 正在生成缓存新增缓存内容0 个字体7 个目录
/usr/share/fonts/default: 正在生成缓存新增缓存内容0 个字体2 个目录
/usr/share/fonts/default/Type1: 正在生成缓存新增缓存内容35 个字体0 个目录
/usr/share/fonts/default/ghostscript: 正在生成缓存新增缓存内容4 个字体0 个目录
/usr/share/fonts/dejavu: 正在生成缓存新增缓存内容9 个字体0 个目录
/usr/share/fonts/fontawesome: 正在生成缓存新增缓存内容2 个字体0 个目录
/usr/share/fonts/liberation: 正在生成缓存新增缓存内容8 个字体0 个目录
/usr/share/fonts/open-sans: 正在生成缓存新增缓存内容10 个字体0 个目录
/usr/share/fonts/overpass: 正在生成缓存新增缓存内容8 个字体0 个目录
/usr/share/fonts/winFonts: 正在生成缓存新增缓存内容1045 个字体0 个目录
/usr/share/X11/fonts/Type1: 正在生成缓存新增缓存内容13 个字体0 个目录
/usr/share/X11/fonts/TTF: 跳过无此目录
/usr/local/share/fonts: 跳过无此目录
/root/.local/share/fonts: 跳过无此目录
/root/.fonts: 跳过无此目录
/usr/share/fonts/default: 跳过探测到循环目录
/usr/share/fonts/dejavu: 跳过探测到循环目录
/usr/share/fonts/fontawesome: 跳过探测到循环目录
/usr/share/fonts/liberation: 跳过探测到循环目录
/usr/share/fonts/open-sans: 跳过探测到循环目录
/usr/share/fonts/overpass: 跳过探测到循环目录
/usr/share/fonts/winFonts: 跳过探测到循环目录
/usr/share/fonts/default/Type1: 跳过探测到循环目录
/usr/share/fonts/default/ghostscript: 跳过探测到循环目录
/usr/lib/fontconfig/cache: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
/usr/bin/fc-cache-64: 缓存生成成功
[rootlocalhost fonts]# source /etc/profile执行下面命令让字体库生效
source /etc/profile如果安装失败可以考虑修改字体权限
chmod 755 *.ttf注意字体安装后必须重启Linux上的Tomcat或Spring boot或其他应用,否则还是不生效
4. 常见问题 执行 sudo mkfontscale 提示 mkfontscale: command not found 1. Ubuntu环境下使用如下命令安装
# 使mkfontscale和mkfontdir命令正常运行
sudo apt-get install ttf-mscorefonts-installer
# 使fc-cache命令正常运行
sudo apt-get install fontconfig在Ubuntu无法联网的情况下安装rpm命令安装包因为有依赖关系顺序如下
1.libfontenc-1.1.3-3.amzn2.0.2.x86_64.rpm
2.libXfont-1.5.2-1.amzn2.0.2.x86_64.rpm
3.xorg-x11-font-utils-7.5-20.amzn2.0.2.x86_64.rpm
4.fontpackages-filesystem-1.44-8.amzn2.noarch.rpm
5.stix-fonts-1.1.0-5.amzn2.noarch.rpm
6.fontconfig-2.10.95-11.amzn2.0.2.x86_64.rpm2. Centos环境下使用如下命令安装
# 使mkfontscale和mkfontdir命令正常运行
yum install mkfontscale
# 使fc-cache命令正常运行。如果提示 fc-cache: command not found
yum install fontconfig