I have to wait for long after using this LibreOffice command which is intended to convert DOCX into PDF:
libreoffice --headless --convert-to pdf test.docx --outdir /pdf
But I'm getting no response and no error. No file is converted. It looks like terminal is hanging.
So, is there is any way to track the error?
I'm using LibreOffice 4.2.8.2 too (on GNU/Linux) but I tried to convert a DOC file to a HTML file. I've installed
libreoffice-headless
, but the terminal was hanging too. I've tried each bullet of Kurt Pfeifle, but it was not working…The solution was simple: installing
libreoffice-writer
(maybelibreoffice-filters
is ok too, but it depends onlibreoffice-writer
plus the other big components of LibreOffice).Hope this will help.
I would first of all try it with giving absolute paths to the command.
I suspect that the
libreoffice
binary does not work -- you have to locate thesoffice
binary and see if that works.Then, your
--convert-to pdf
is not sufficient. It needs to be:Be sure to follow exactly this capitalization!
Next, the command will not work if there is already a LibreOffice GUI instance up and running on your system. It is caused by bug known since 2011. Add this additional parameter to your command:
This will create a new, separate environment which can be used by a second, headless LO instance without interfering with a possibly running first GUI LO instance started by the same user.
Also, make sure that the
--outdir /pdf
you specify does exist, and that you have write permission to it. Or, rather use a different output dir. Even if it is just for the first testing and this debugging round:Hence:
This works for me on Mac OS X Mavericks 10.9.5 with LibreOffice v4.4.3.2 (using my specific path for the binary
soffice
which will be different for you anyway...).If all this doesn't work:
It may be a problem with the specific DOCX file you try the command with... So create a very simple DOCX document of your own first. Use LibreOffice itself for this. Write "Hello World!" on an otherwise empty page. Save it as DOCX.
Try again. Does it work with the simple DOCX?
If it again doesn't work, repeat step 7, but save as ODT this time.
Repeat step 8, but make sure to reference the ODT this time.
Last: Use full path to
soffice
, tosoffice.bin
and tolibreoffice
and run each with the-h
parameter:Compare them to the command line you used:
For comparison, my own output is here:
Add one more argument to your command line to enforce the application of an input filter when
soffice
opens your DOCX file:or
Update
LibreOffice cannot only convert DOCX to PDF on the command line:
Of course, results will never be perfect, and sometimes they will even be un-acceptable to you.
Re. output as PDF:
To control, which LibreOffice component generates PDF output, you can use these variants:
Re. input which is not DOCX:
To enforce infilters for non-DOCX input formats, you could use (list is not complete):
Re. output which is not PDF:
To convert to specific output formats, you could use (list not complete):
Update
The current Version of libreoffice is working: v5.2.6.2 (mac)
I'm using the following command
OLD
It seems that the conversion is not working in newer version (> 4.2.4.2) I'm using libreoffice 4.2.4.2 You can download older versions from http://downloadarchive.documentfoundation.org/libreoffice/old/4.2.4.2/
linux (using the deb package):
windows:
Might sound stupid but I suffered from just this: In Ubuntu 14.04 it is not enough to install only the package libreoffice-core or -common to convert to PDF, but you need to install libreoffice-writer instead/additionally. The important thing to note is that libreoffice-core|common seems to bring in some functional libreoffice base, hence the name ;-), which doesn't error out if executed to convert some file, but instead just seems to wait on some socket or such for input or whatever... After I installed libreoffice-writer, which has -core|common as a dependency, converting some ODT file to PDF worked like a charm with the exact same command line like used before.
Seems a bit crazy that the application looks like it works somehow, but simply couldn't ever because of missing packages, and doesn't tell anything about it.