Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Sep 20 '11 at 6:09

This question came from our site for professional and enthusiast programmers.

    
Thanks, but nothing works for me. :) – CSchulz Sep 19 '11 at 16:33
up vote 2 down vote accepted

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).

share|improve this answer
    
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 '11 at 10:12
    
libreoffice -headless -convert-to pdf document.doc How about this? – Goran Jurković Oct 6 '11 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 '11 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. – Goran Jurković Oct 13 '11 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 '11 at 7:41
lowriter --convert-to pdf *.doc

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

share|improve this answer
    
Thanks but I haven't a running X-Server. – CSchulz Sep 20 '11 at 11:32

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

share|improve this answer

If you need the reverse convertion, or other nice PDF conversion, you could try this online tool: http://kitpdf.com/.

share|improve this answer

You must log in to answer this question.

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