Libreoffice only convert from odt to pdf, not other formats

libreoffice

Solution

This is a known issue in LibreOffice that was fixed in version 5.3.0. Before this fix when an instance of LibreOffice is running --convert-to or any other command would silently terminate without doing anything.

If your version is older than that you could consider the solution suggested by Frank Yin here. That is close all open LibreOffice documents before running the conversion.

If you cannot close all open LibreOffice documents to run the conversion, or if you find it inconvenient, you could try a solution suggested in the comments to the original bug.

If you have LibreOffice version before 4.5 run

soffice -env:UserInstallation=file:///$HOME/.libreoffice-headless/ \
--headless --convert-to pdf test.docx

If you are running LibreOffice version between 4.5 and 5.3 run

soffice -env:UserInstallation=file:///$HOME/.libreoffice-headless/ \
--convert-to pdf test.docx

Here `$HOME/.libreoffice-headless` is a new profile directory different from your main LibreOffice profile.

Problem

I'm trying to convert documents from html,txt to pdf,odt and vice versa.. But only odt to pdf seems to work.. No other file formats are converted Here are my commands ``` libreoffice --headless --convert-to pdf test.html [Not working] libreoffice --headless --convert-to odt test.html [Not working] libreoffice --headless --convert-to pdf test.docx [Not working] libreoffice --headless --convert-to pdf test.odt [Working] ```

Original source