How to convert PHP word to PDF under Linux: first install openoffice; then enter the RPMS directory and execute the command "rpm –ivh *rpm"; then choose to install the relevant packages and start OpenOffice; finally implement it through the jodconverter method Just convert.
Recommended: "PHP Video Tutorial"
Linux platform PHP to realize word to pdf
1. Searching for information on the Internet is nothing more than the COM component of openoffice PHP, but it is not reliable after trying many times
2. Later I found openoffice jodconverter (requires java environment)
一, Install openoffice
1. Attached is the openoffice download link https://www.openoffice.org/download/index.html
2. Download your own The Linux version I chose is 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
- Check ps -ef|grep soffice process
- Check Kill process kill -9 4119/4119
2. Install jodconverter
1. Download jodconverter-2.2.2 Download address https://sourceforge.net/projects/jodconverter/files/
2. Unzip in linux jodconverter-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
4. If Chinese garbled characters appear (Chinese is not displayed), please refer to: Solution to the problem of converting openoffice word files to PDF Chinese garbled characters under Linux
The above is the detailed content of How to convert php word to pdf under linux. For more information, please follow other related articles on the PHP Chinese website!

在之前的文章《实用Word技巧分享:详解怎么更改图片颜色和形状》中,我们了解了更改图片颜色和图片形状的方法。而今天我们来聊一聊word表格,讲解美化表格--自定义表格样式的方法,快来看看吧!

在之前的文章《实用Word技巧分享:聊聊你没用过的“行号”功能》中,我们了解了Word中你肯定没用过的"行号”功能。今天继续实用Word技巧分享,看看Excel表格怎么借用Word进行分栏打印,快来收藏使用吧!

在之前的文章《实用Word技巧分享:隐藏图片,提升文档浏览和编辑效率!》中,我们学习了隐藏图片的技巧,可提升文档浏览和编辑效率。下面本篇文章再给大家分享一个实用Word技巧,看看怎么让页面自动滚动,快来收藏使用吧!

在之前的文章《实用Word技巧分享:设置页码的终极方法!》中,我们学习了Word页码的设置方法。而今天我们来一起聊聊Word文本间距设置的几个技巧,快来收藏使用吧!

在之前的文章《实用Word技巧分享:表格自定义样式,美化表格!》中,我们了解了自定义表格样式的方法。而今天我们来聊一聊word脚注和尾注,介绍一下脚注和尾注的设置使用方法,快来看看吧!

在之前的文章《实用Word技巧分享:怎么跨文档快速复制样式》中,我们了解了在文档间快速复制样式的方法。今天我们聊聊Word快捷键,聊聊【F4】键快速统一图片大小,快来看看吧!

在之前的文章《实用Word技巧分享:如何一键删除所有数字》中,我们学习了Word中一键删除所有数字的方法。而今天我们来聊聊Word表格中如何自动添加编号,简单却很实用!

在之前的文章《实用Word技巧分享:图、表如何自动编号?》中,我们了解了Word排版-让图、表自动编号的方法。而今天聊聊Word精确控制页面“行数”和“字符个数”的方法,快来看看吧!


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)
