You may want to convert a document to another format document.
For example, I want to convert Excel to PDF.
For PC, Excel in Office can easily convert other formats by saving them.

If you want to convert automatically by a program instead of user operation, you can do it by using Openoffice.

command:
sudo su -
wget https://sourceforge.net/projects/openofficeorg.mirror/files/4.1.6/binaries/ja/Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_ja.tar.gz
tar -xvzf Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_ja.tar.gz
cd ja/RPMS
rpm -Uvih *rpm
#Installation confirmation
ll /opt/openoffice4
#Create a symbol link
ln -s /opt/openoffice4/program/soffice /usr/local/bin/soffice
#Japanese font installation
sudo yum install ipa-gothic-fonts ipa-pgothic-fonts
sudo fc-cache -fv
# en_US.UTF-If it is 8, Japanese characters are garbled, so set Japanese
export LANG=ja_JP.UTF-8
#Start-up
nohup soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
#Start confirmation
ps aux | grep soffice
This is a sample to convert testfile.txt to PDF file.
soffice --headless --convert-to pdf testfile.txt
Convert with a library called jodconverter jodconverter:https://github.com/sbraconnier/jodconverter/
// https://mvnrepository.com/artifact/org.jodconverter/jodconverter-local
compile group: 'org.jodconverter', name: 'jodconverter-local', version: '4.2.2'
DocConverter.java
import java.io.File;
import org.jodconverter.DocumentConverter;
import org.jodconverter.LocalConverter;
import org.jodconverter.office.LocalOfficeManager;
import org.jodconverter.office.OfficeException;
import org.jodconverter.office.OfficeManager;
public class DocConverter {
	public static void main(String[] args) throws OfficeException {
		OfficeManager officeManager = LocalOfficeManager.make();
		DocumentConverter converter = LocalConverter.make(officeManager);
		try {
			officeManager.start();
			File inputFile = new File("/data/test.xlsx");
			File outputFile = new File("/data/test.pdf");
			// Convert...
			converter.convert(inputFile).to(outputFile).execute();
		} finally {
			officeManager.stop();
		}
	}
}
Control Panel ⇒ Settings ⇒ Server Management ⇒ External Services

URL:https://www.openoffice.org/
that's all
Recommended Posts