Last year, the development of an OA system, need to implement a key document upload and realize online preview, similar to the function of Baidu Library.
System Environment: CentOs5.5
Tools used: Openoffice 3, pdf2swf tool, Jodconverter, Flexpaper
On the Internet to find some information, someone has already realized such a function, but it is written in Java, PHP did not find.
Combined with the data on the Internet to achieve operational experience.
Record and summarize:
The whole idea is as follows:
Implementation steps: 1. Doc uploaded 2. Doc converted to PDF 3. PDF into SWF 4. Show
Based on the introduction of the Linux environment OpenOffice SDK + PDF2SWF tool, two steps, using the OpenOffice SDK to unify the document into a PDF, and then use PDF2SWF tool the PDF into SWF
Implementation process
To implement doc into PDF, there is a OpenOffice under Linux that can be implemented.
Then the first need is to install OpenOffice this dongdong.
1. Installation Openoffice3, this installation process is very tangled, encountered a variety of problems, because successively installed in several servers, the most successful installation methods are as follows, if you encounter problems, please see the previous article has said OpenOffice installation.
Tar zxvf ooo_3.3.0_linux_x86-64_install-rpm-wjre_zh-cn.tar.gz
CD RPEM
RPM-IVH *.rpm--nodeps–force
The default directory after installation is under:/opt/directory
To start the service:
/opt/openoffice.org3/program/soffice-headless-accept= "SOCKET,HOST=127.0.0.1,PORT=8100;URP;"-nofirststartwizard &
Below the CentOS there will be a lack of bold and Arial, directly to the font directory under Windows copy Bold and Arial into the catalog
/opt/openoffice.org/basis3.3/share/fonts/truetype/
Requires a reboot before it will take effect.
2. Installation of OpenOffice SDK3.3
Tar zxvf ooo-sdk_3.3.0_linux_x86-64_install-rpm_en-us.tar.gz
CD ooo330_m20_native_packed-1_en-us.9567/rpms/
RPM-VIH *.rpm
3. Install jodconverter.2.2.2, after installing this can already realize doc turn pdf.
This installation is very simple, directly on the site next to this dongdong back.
Decompression, copied to a directory inside, you can directly use, call it inside the/lib/jodconverter-cli-2.2.2.jar this thing on the line, you can run the command test directly:
Java-jar/usr/local/wenku/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar/tmp/1.doc/tmp/1.pdf