Libreoffice convert-to not working

2019-01-18 21:38发布

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]

10条回答
家丑人穷心不美
2楼-- · 2019-01-18 22:30

For me, the following two packages were the minimum needed to get headless docx to pdf conversion working on CentOS 7 :

yum install libreoffice-headless  libreoffice-writer
查看更多
不美不萌又怎样
3楼-- · 2019-01-18 22:31

This worked for me on LibreOffice 4.2 / Linux:

soffice --headless --convert-to txt:Text /path_to/document_to_convert.odt

Credit: http://ask.libreoffice.org/en/question/14130/how-do-i-install-filters-for-the-soffice-command/

查看更多
放我归山
4楼-- · 2019-01-18 22:35

For me. The problem I had was that --headless does not work, AT ALL (just returns in 15 milli-seconds), if a local libreoffice process already has the document open.

Make sure you only do headless operations on a document that is NOT already open in LibreOffice.

查看更多
男人必须洒脱
5楼-- · 2019-01-18 22:36

The real problem is that the libreoffice/soffice command line doesn't provide any error message or debugging information, so it's all guesswork. If you are up to it, then try strace for hints.

In my case (Linux), I didn't have the correct packages installed - for example, to convert spreadsheets, libreoffice-calc is needed (duh), and also libreoffice-headless (double-duh). But the command line won't tell you that - it just hangs, or runs and doesn't do anything.

查看更多
登录 后发表回答