Convert .rtf File to .pdf With LibreOffice


Mon Oct 03 2022 08:50:14 GMT+0000 (UTC)

Saved by @HristoT #c#

# install the library
sudo apt update && sudo apt install libreoffice

# convert file 
soffice --headless --invisible --norestore --convert-to pdf <source rtf file> --outdir <output directory>
# convert folder (cd to the folder)
lowriter --headless --invisible --norestore --convert-to pdf *.<the extension we want to convert>

# if the files are too much and it crashes half way
find . -name "*.<the extension we are going to convert>" -type f -print0 |xargs -0 -I {} libreoffice --headless --convert-to pdf --outdir <directory to save the pdfs> {}