Project requirements require some preprocessing of uploaded documents. If the user uploads a document in doc format, it needs to be processed into docx or pdf format so that the subsequent process can extract the document content. I first tried the Then I discovered the open source tool LibreOffice. After using it, I found it to be very effective, so I’d like to share it with you. The server is CentOS7. Use yum to install LibreOffice directly. It takes about 600MB+ of disk space: # You can delete it before installing it to prevent it from being installed before. yum remove libreoffice-* yum install libreoffice After waiting for the installation to complete, confirm the version. Although the official version is 6.1, the yum package is still 5.3.6, but there is no problem in using it. Here I still recommend that you use your own Linux system package management tool to install it, which can save a lot of trouble. [root@localhost /]# soffice --version LibreOffice 5.3.6.1 30 (Build: 1) If you don't know how to use it, you can use soffice --help to see the help. There are many parameters and usage cases. The format conversion is very simple: soffice --headless --convert-to docx /opt/upload/source/123.doc --outdir /opt/upload/source The above command converts the By default:
A successful conversion will output something like this: convert /opt/upload/source/123.doc -> /opt/upload/source/123.docx using filter : MS Word 2007 XML Overwriting: /opt/upload/source/123.docx LibreOffice will automatically match the format filter according to the file format. As for which formats it supports, you can refer to the official website. Summarize The above is the editor's introduction to the method of using LibreOffice under CentOS to achieve document format conversion. I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: mysql8.0 windows x64 zip package installation and configuration tutorial
>>: How to implement parent-child component communication with Vue
Mysql installation, configuration, and optimizati...
jQuery realizes the effect of theater seat select...
Table of contents 1. Extracting functions 2. Merg...
The mini program collected user personal informat...
Preparation Windows Server 2008 R2 Enterprise (2....
Mini Program Data Cache Related Knowledge Data ca...
Give time time and let the past go. In the previo...
Table of contents 1. Preparation before developme...
Preface In our daily work, we often need to renam...
If you want to become a Linux master, then master...
Table of contents 1. Data Source 2. Overall ranki...
1. Download nginx [root@localhost my.Shells]# doc...
If you don’t understand what I wrote, there may b...
Table of contents Why do we need partitions? Part...
This article introduces common problems of Xshell...