Convert .rtf File to .pdf With LibreOffice

PHOTO EMBED

Mon Oct 03 2022 08:50:14 GMT+0000 (Coordinated Universal Time)

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> {}

# count the files
find <folder path> -mindepth 1 -type f -name "*.<extension>" -exec printf x \; | wc -c
content_copyCOPY