Linux under PHP file conversion

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.