I have Libreoffice 184.108.40.206 installed in Ubuntu 20.04 server (no GUI). I am converting a Word DOCX file to PDF with a bash script using soffice, but the resulting PDF does not respect the original font of the Word doc (Garamond). Instead, it’s using DejaVuSerif. Here’s my original command:
soffice --headless --invisible --convert-to pdf "<filename>"
I tried installing a Garamond font in Ubuntu:
sudo apt-get install fonts-ebgaramond-extra
which put a Garamond font in my /usr/share/fonts folder:
However, Libreoffice does not use this font when converting the DOCX. I’m not sure if the font I installed is equivalent with the version of Garamond in Word, or if there are extra steps involved to install the font in Libreoffice.
Then I tried messing with the - -infilter option. I’m not sure if that’s the right option to use, but I saw some threads that mentioned controlling the font using - -infilter:
soffice --headless --invisible --infilter="writer_pdf_export:,,Garamond," --convert-to pdf "<filename>"
I tried many different combinations of parameters in - -infilter, but none of them seemed to have any effect. I tried using different names for the font: Garamond / EBGaramond / garamond / ebgaramond / EB Garamond.
I also tried adding some extra parameters to the - -convert-to option based on some examples I saw in another thread:
soffice --headless --invisible --convert-to "pdf:writer_pdf_Export:UTF8:LF:Garamond" "<filename>"
None of these attempts have had any effect on the resulting font in the PDF. Does anyone know if it’s possible to do this with soffice on the command line? Maybe the font can be changed in the resulting PDF after the conversion has run?