In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Project requirements, some pre-processing of the uploaded documents. If users upload documents in doc format, they need to process them into docx or pdf format, so that subsequent processes can extract the contents of the documents.
First, I tried the phpoffice/phpword package and found that its conversion to doc is not ideal. This package is more suitable for generating documents based on content than transforming documents, which is not very suitable for my needs.
Then found the LibreOffice this open source tool, after use, the effect is very good, share.
The server is CentOS7. It takes about 600MB + disk space to install LibreOffice directly using yum:
# you can delete it before installing it to prevent yum remove libreoffice-*yum install libreoffice from being installed before
Wait for the installation to complete, confirm the version and so on, although the official version has reached version 6.1, there is still a 5.3.6 package in yum, but there is nothing wrong with it. Here, I suggest you use their own Linux system package management tools to install, which can save you a lot of trouble.
[root@localhost /] # soffice-- versionLibreOffice 5.3.6.1 30 (Build:1)
If you don't know how to use it, you can use soffice-help to take a look at the help. With so many parameters and use cases, the conversion format is simple:
Soffice-- headless-- convert-to docx / opt/upload/source/123.doc-- outdir / opt/upload/source
The above command is to convert the / opt/upload/source/123.doc file to docx format and output it to the / opt/upload/source folder.
By default:
The output file will be saved with the source file name + new extension; the existing files with the same name in outdir will be overwritten
A successful conversion will output something like this:
Convert / opt/upload/source/123.doc-> / opt/upload/source/123.docx using filter: MS Word 2007 XMLOverwriting: / opt/upload/source/123.docx
LibreOffice automatically matches the format filter (filter) based on the file format. As for which formats it supports, please refer to the official website.
Summary
The above is the editor introduced to you under the CentOS using LibreOffice to achieve document format conversion, I hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.