发布时间:2020/05/03 作者:天马行空 阅读(1839)
LINUX:
1、安装java环境和基础配置
yum install gcc-c++ yum -y install giflib-devel libjpeg-devel freetype-devel t1lib-devel zlib yum -y install java-1.6.0-openjdk* yum -y install mkfontscale
2、安装openoffice
cd RPMS rpm –ivh *rpm(安装所有rpm文件) cd desktop-integration rpm -ivh openoffice.org3.2-redhat-menus-3.2-9472.noarch.rpm
3、启动openOffice服务
cd /opt cd openoffice.org4 cd program /opt/openoffice.org4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
4、测试doc转pdf
java -jar /opt/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar /home/php/1.doc /home/php/1.pdf
5、安装swftools
tar xzf swftools-0.9.1.tar.gz cd swftools-0.9.1 ./configure make make install
6、测试pdf转swf
pdf2swf -o /home/php/1.swf -T -z -t -f /home/php/1.pdf -s languagedir=/usr/local/share/xpdf/chinese-simplified flashversion=9
7、解决中文转换后乱码(将 windows下的simsun.tcc 字体拷贝到 /usr/share/fonts/simsun/ 下并且重建Linux字体索引)
mkfontscale mkfontdir fc-cache soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
开机启动openoffice
编辑/etc/rc.local
在最后面,添加:
/usr/lib/program/soffice -headless -accept="socket,port=8100;urp;"
netstat -ntlp(查看端口占用情况)
pgrep soffice(查看soffice涉及到的pid)
kill -s 9 2028(杀死2028这个pid)
WINDOWS安装:
1、下载安装openoffice
http://netassist.dl.sourceforge.net/project/openofficeorg.mirror/4.1.2/binaries/zh-CN/Apache_OpenOffice_4.1.2_Win_x86_install_zh-CN.exe
2、启动openoffice服务
cd C:/Program Files (x86)/OpenOffice 4/program
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
3、安装java jdk
http://211.162.175.31/files/2173000002252678/202.201.14.199/download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-windows-i586.exe
4、测试转换
C:/Program Files (x86)/Java/jdk1.8.0_65/bin/java -jar D:/server/www/anguan/lib/jodconverter-cli-2.2.2.jar D:/server/www/anguan/test.docx D:/server/www/anguan/test.pdf
5、安装swftools
http://www.swftools.org/swftools-0.9.0.exe
windows下安装完成后发现php无法调用openoffice命令,之后发现删除了apache的日志文件重启apache后就能调用成功,暂时还没找到原因是什么。
flexpaper调用实例