1. 程式人生 > >centos6.5下安裝openoffice+jodconverter+swftool+flexpaper工具實現線上預覽文件功能

centos6.5下安裝openoffice+jodconverter+swftool+flexpaper工具實現線上預覽文件功能

作用:linux下文件伺服器上傳文件轉換成pdf文件,再由swftool工具轉換成swf檔案實現線上預覽 環境:OS   centos6.5           java環境 軟體包:Apache_OpenOffice_4.1.3_Linux_x86-64_install-rpm_zh-CN.tar.gz   http://sourceforge.net/projects/openofficeorg.mirror/files/4.1.3/binaries/zh-CN/Apache_OpenOffice_4.1.3_Linux_x86-64_install-rpm_zh-CN.tar.gz
             jodconverter-2.2.2.zip               swftools-2013-04-09-1007.tar.gz    http://www.swftools.org/swftools-2013-04-09-1007.tar.gz
一、openoffice的安裝 1、下載linux下的安裝包 http://www.openoffice.org/  
http://sourceforge.net/projects/jodconverter/files/ 我下載的是最新版本 # cd /usr/local/src # wget  http://sourceforge.net/projects/openofficeorg.mirror/files/4.1.3/binaries/zh-CN/Apache_OpenOffice_4.1.3_Linux_x86-64_install-rpm_zh-CN.tar.gz 2、解壓安裝 #tar zxvf Apache_OpenOffice_4.1.3_Linux_x86-64_install-rpm_zh-CN.tar.gz # cd zh-CN/RPMS # rpm -ivh *.rpm      #安裝所有rpm包 3、
進入到desktop-integration目錄,選擇安裝相關的套件,我選擇的是redhat # rpm -ivh openoffice4.1.3-redhat-menus-4.1.3-9783.noarch.rpm 4、啟動openoffic服務,安裝在/opt下 進入opt下的openofiice4目錄: # cd /opt/openoffice4/program 啟動服務 # soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &  檢視埠
已經正常啟動;
二、jodconvert的安裝測試
下載jodconvert包
然後解壓,找到jar包執行路徑
/usr/local/jodconverter/lib/jodconverter-cli-2.2.2.jar 測試 java -jar  /usr/local/jodconverter/lib /jodconverter-cli-2.2.2.jar test.doc test.pdf 發現生成pdf檔案,說明openoffice安裝啟動成功 服務加入開機自啟動 #vim /etc/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. #route add default gw 192.168.50.1 soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard & touch /var/lock/subsys/local
三、 swftools安裝  1、下載地址 http://www.swftools.org/download.html # wget http://www.swftools.org/swftools-2013-04-09-1007.tar.gz 2、安裝依賴包 #  yum -y install giflib-devel libjpeg-develfreetype-devel t1lib-devel zlib 3、解壓 # tar zxvf swftools-2013-04-09-1007.tar.gz # cd swftools-2013-04-09-1007 # ./configure 5.編譯安裝 # make && make install 6、 查詢安裝成功後的which pdf2swf目錄 #which pdf2swf /usr/local/bin/pdf2swf
QS:後來發現安裝openoffice轉換效果並不理想,首先是速度較慢,再就是很多舊文件,檔案格式支援性不好,部分文件不能轉換,於是乎安裝libreoffice 步驟與openoffice差不多 1、官網開啟 http://zh-cn.libreoffice.org/download/libreoffice-still/ 2、下載穩定版本 http://zh-cn.libreoffice.org/download/libreoffice-still/?type=rpm-x86_64&version=5.2&lang=zh-CN 3、下載 # wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/5.2.5/rpm/x86_64/LibreOffice_5.2.5_Linux_x86-64_rpm.tar.gz 下載中文支援包 # wget  http://download.documentfoundation.org/libreoffice/stable/5.2.5/rpm/x86_64/LibreOffice_5.2.5_Linux_x86-64_rpm_langpack_zh-CN.tar.gz 4、解壓,並且到RPMS下,安裝所有的rpm包 # rpm -ivh *.rpm 5、開啟服務(與openoffice一致) soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard & 
四、參考文件: http://blog.csdn.net/cuker919/article/details/46389449