Linux解决openoffice转换PDF乱码问题(ubutun16.0.4)

将windows的字体复制到/usr/share/fonts目录下,如/usr/share/fonts/winfonts然后执行命令

sudo mkfontscale (创建雅黑字体的fonts.scale文件,它用来控制字体旋转缩放)
sudo mkfontdir (创建雅黑字体的fonts.dir文件,它用来控制字体粗斜体产生)
sudo fc-cache -fv (建立字体缓存信息,也就是让系统认识认识雅黑)

 

以下是我安装openoffice的shell,解决了乱码问题

#!/bin/sh
#openoffice安装脚本

curdir=`pwd`
echo "start install openoffice..."

#卸载libreoffice
sudo apt-get remove libreoffice


echo "install libdebs.................."
#安装依赖库
cd $curdir
cd libdebs

dpkg -i x11-common_1%3a7.7+13ubuntu3_all.deb libice6_2%3a1.0.9-1_i386.deb libsm6_2%3a1.2.2-1_i386.deb libxt6_1%3a1.1.5-0ubuntu1_i386.deb

echo "finish libdebs.....exit ....."

#安装linux字体管理软件
cd $curdir
echo "install linux font soft"
cd fontconfig
dpkg -i *.deb


cd $curdir

#安装openoffice
cd DEBS/
sudo dpkg -i *.deb

#cd $curdir

#安装菜单项
#cd DEBS/desktop-integration/
#sudo dpkg -i openoffice4.1-debian-menus_4.1.3-9783_all.deb

cd $curdir

#复制字体


#tar -zxvf fonts.tar.gz
echo "copy fonts..............................."
cp -rf winfonts /usr/share/fonts

cd /usr/share/fonts/winfonts

sudo mkfontscale

sudo mkfontdir

sudo fc-cache -fv


echo "install jdk for openoffice..............."
cd $curdir
cp -rf jdk /opt/openoffice4

newPath="$PATH:/opt/openoffice4/jdk/bin"
str='PATH="'${newPath}'"'

echo $str >/etc/environment

#sudo source /etc/environment

PATH=$PATH:/opt/openoffice4/jdk/bin




#启动
echo "openoffice run............................."



/opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &

ps -A|grep soffice

echo "openoffice run success..."

 

posted @ 2018-07-02 11:11  Againn  阅读(2596)  评论(0编辑  收藏  举报