4

I try to convert a doc file to a pdf file with the linux bash.
I tried different ways like jodconverter, ghostscript, postscript and so on, but all didn't work as espected.
Additionally I can say that I have only the bash.

Is there any way, which you can advice me?

1
  • Thanks, but nothing works for me. :)
    – CSchulz
    Sep 19, 2011 at 16:33

3 Answers 3

3

Have you tried unoconv?

I did, and it seems to work. This is what I did (after lots of googling :):

  1. I installed unoconv (I had Libre Office installed)
  2. Booted to console (no X server running)
  3. Started soffice in headless mode with this command:

    /usr/lib/libreoffice/program/soffice.bin -headless -nofirststartwizard -accept="socket,host=localhost,port=8100;urp;StarOffice.Service" &

After that, simple unoconv document.doc converted document.doc to document.pdf (pdf is default output format).

12
  • Thanks for the answer. I get following error "unoconv: UnoException during conversion: URL seems to be an unsupported one. The provided document cannot be converted to the desired format.". I searched for it at google, but I can't find any solution.
    – CSchulz
    Oct 5, 2011 at 10:12
  • libreoffice -headless -convert-to pdf document.doc How about this? Oct 6, 2011 at 12:38
  • The argument headless is deprecated. --headless is the new argument. :) I got following error: stat: cannot read file system information for `test.doc': Input/output error
    – CSchulz
    Oct 12, 2011 at 8:28
  • Hm, it could be some kind of a file system problem... I assume test.doc is in your current directory, try stat test.doc It could be that you are not able to access that file at all. Oct 13, 2011 at 14:31
  • Now it seems that the command work, but I can't find the output or an argument for it.
    – CSchulz
    Oct 14, 2011 at 7:41
10
lowriter --convert-to pdf *.doc

lowriter is the 'writer' program from LibreOffice (maybe your distro's LibreOffice package differs - check this!).

1
  • 1
    Thanks but I haven't a running X-Server.
    – CSchulz
    Sep 20, 2011 at 11:32
4

Get into the folder that has your LibreOffice and run this in terminal.

./soffice --headless --convert-to pdf --outdir destination_path source_path/*.doc 

Or using Unoconv

unoconv -f pdf File.doc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .