How to convert linux php word to pdf: first install openoffice; then enter the RPMS directory and execute the "rpm –ivh *rpm" command; then start OpenOffice; and finally achieve the conversion by calling the jodconverter method.
Recommended: "PHP Video Tutorial"
1. Searching for information online is nothing more than the com component of openoffice PHP. However, I tried many times but it was not reliable
2. Later I found openoffice jodconverter (requires java environment)
1. Install openoffice
1. Attached is the openoffice download link https://www.openoffice.org/download/index.html
2. Download your own corresponding Linux version. I chose the Red Hat version
3. The decompressed directory is zh-CN, which contains RPMS, readmes, and licenses.
4. Enter the RPMS directory
5. Execute rpm –ivh *rpm (install all rpm files)
6. Enter the desktop-integration directory and select the installation related Suite, I chose redhat
rpm -ivh openoffice4.1.5-redhat-menus-4.1.5-9789.noarch.rpm
7. OpenOffice has been installed and will be installed under /opt by default
Start OpenOffice
soffice -headless -accept=”socket,host=127.0.0.1,port=8100:urp;” -nofirststartwizard &
After starting, enter program againnetstat –tln
Check whether the startup is successful! As shown in the picture above, port 8100 can be used.
Stop Openoffice
2. Install jodconverter
1. Downloadjodconverter-2.2.2Download address https://sourceforge.net/projects/jodconverter/files/
2. Unzip in linuxjodconverter-2.2.2.zip
unzip /opt/jodconverter-2.2.2.zip -d /opt
3. Call the jodconverter method to convert word->pdf
java -jar /opt/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar ./1.docx ./1.pdf
The above is the detailed content of How to convert word to pdf using PHP on linux platform. For more information, please follow other related articles on the PHP Chinese website!