Get the App
SLTechnology News&Howtos  ›  Servers  › 

The office document of linux platform is transferred to pdf instance (programmer's dish)

Shulou Source: shulou.com Published: 2022-06-02 01:52:42 11月14日 Update

Materials required:

1. Openoffice3.4 (I am a 32-bit centos, and I can download the specified openoffice software package according to my own system)

Download address: http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.1/Apache_OpenOffice_incubating_3.4.1_Linux_x86_install-rpm_en-US.tar.gz/download

2 、 jodconverter.2.2.2

Download address: http://sourceforge.net/projects/jodconverter/files/latest/download?source=files

3. 32-bit centos5.5 (a lot of Internet searches)

4 、 jdk1.7

The idea is simply to install openoffice3.4 and convert the document with jodconverter.2.2.2.

Detailed steps:

1. Decompress the downloaded openoffice package and enter the directory of the package. Only use the following command.

Package name of tar-zxvf openoffice

2. After decompressing, a zh-CN (or something similar, depending on the language) will be generated. After entering the directory, there will be a rpms and enter the rpms folder. Type the following command to install openoffice (if you are prompted for any dependencies, you need to install them one by one. Some systems: rpm-ivh * .rpm, will not be installed automatically)

Rpm-ivh * .rpm

3. After installation, you should start the openoffice service. Enter the following command, and openoffice is installed by default in the / opt file. (if you start the service, you will encounter a series of errors. You can find the search engine.)

/ opt/openoffice.org3/program/soffice-headless-accept= "socket,host=127.0.0.1,port=8100;urp;"-nofirststartwizard &

4. Determine whether the openoffice service is enabled successfully.

Ps aux | grep soffice to view the process

5. After enabling the openoffice service successfully, use jodconverter.2.2.2 to convert. You can use the following command (it is best to use the root user, otherwise you will encounter a lot of permission problems)

Decompression path of jodconverter: / usr/local/wenku/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar

File to be converted: / tmp/1.doc

Converted file: / tmp/1.pdf

Java-jar / usr/local/wenku/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar / tmp/1.doc / tmp/1.pdf

If successful, there will be an extra pdf file under the / tmp folder.

Open pdf if there is garbled code, please see (solve the problem of Chinese garbled code from openoffice word file to PDF under linux)

The above linux platform office document to pdf example (programmer's dish) is the editor to share with you all the content, I hope to give you a reference, but also hope that you support more.

Tags: Files commands services success documents garbled addresses that is folders directories systems problems inputs instances platforms programs programmers a search content can make Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB macOS Xiaomi Shulou Tech Info OPPO Reno