Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a set of files in .doc format, that need to be converted to .pdf format. I am using Ubuntu linux.

share|improve this question

migrated from serverfault.com Jun 24 '10 at 12:33

This question came from our site for professional system and network administrators.

add comment

9 Answers

Alternative 1)

sudo apt-get install cups-pdf

Then navigate to System > Administration > Printing and create a new printer, set it as a PDF file printer, and name it as "pdf".

Then run:

oowriter -pt pdf your_word_file.doc

Now you'll find your .pdf file in ~/PDF.


Alternative 2)

sudo apt-get install wv tetex-extra ghostscript  
wvPDF test.doc test.pdf

If the tetex-extra package is not available with your distro, try texlive-base plus texlive-latex-base:

sudo apt-get install wv texlive-base texlive-latex-base ghostscript  
wvPDF test.doc test.pdf
share|improve this answer
1  
in oowriter -pt pdf your_word_file.doc, is the printer specified? In my computer, it will try to print to an actual printer instead of a pdf printer. –  Tim Aug 8 '11 at 18:40
    
How can I change the ~/PDF path to somewhere else ? –  hd. Jan 13 '13 at 5:05
1  
OpenOffice is generally now replaced with LibreOffice, so the command is lowriter –  user60561 Mar 7 at 1:05
    
for LibreOffice, the command is lowriter --convert-to pdf your_word_file.doc and the default is to output in the current directory. –  GreyBeardedGeek May 19 at 2:43
add comment

If you're running X then you can do it through Open Office. Since you're about to object to doing it manually, remember there's some nice macro scripts in Open Office so you can automate it. You can do something similar with AbiWord (AbiWord --to=pdf).

If you've not got X then there is antiword, but that just extracts the text - doesn't do any formatting or graphics. There's also wvWare which I've used to bulk extract images from doc files, but I've never tried using it to convert doc files to pdfs.

Oh and .docx files may well need something different, but since they're just zipped xml files it shouldn't be too difficult to do something useful with them. For bulk extracting images you just unzip them and copy the images directory, but I've never needed to convert them in Linux.

share|improve this answer
add comment

You can use:

oowriter -convert-to pdf:writer_pdf_Export doc_file.doc
share|improve this answer
2  
Short and simple - however, if one is running LibreOffice (or is running OO.org and cannot find oowriter) -- the command is swriter -convert-to pdf:writer_pdf_Export x.doc. –  new123456 Jan 21 '12 at 4:05
    
For Libreoffice, this works: writer -convert-to pdf:writer_pdf_Export file.docx –  kolypto Jul 3 '12 at 15:08
1  
On my Ubuntu 12.04 with the default LibreOffice, I had to use lowriter instead of (oo|s| )writer. Then it worked with the same arguments as above: lowriter -convert-to pdf:writer_pdf_Export file.docx. The .pdfs are created in the current directory. –  mivk Sep 6 '12 at 23:05
    
I like this. On my 3.6.6.2 -convert-to pdf chose writer_pdf_Export as default. Also something to keep in mind - don't have any LO instances open when running this command, otherwise it will just open an empty new document in the GUI. Can this be avoided somehow? –  lkraav Jun 28 '13 at 12:24
add comment

Printing to PDF loses a lot of the document metadata (title, authorship, the headings tree that is used for navigation, and so on).

Install unoconv, convert with: unoconv -fpdf file1.doc file2.doc…

share|improve this answer
    
Thanks for the suggestion. But I think the syntax provided by you is wrong. $ unoconv myfile.doc It converts to PDF format by default and so you get myfile.pdf on executing the command. –  nitins Jun 24 '10 at 11:07
    
@nit thanks, fixed. –  Tobu Jun 24 '10 at 12:20
    
This is the best solution, it totally handles talking to LibreOffice for you. –  thirtythreeforty Oct 11 '13 at 2:53
add comment

You can also do it with AbiWord:

sudo apt-get install abiword

Then you can load .doc files in AbiWord's GUI and export to PDF, or from the commandline:

abiword --to=pdf filename.doc

share|improve this answer
add comment

I would try using for Linux

$ /opt/openoffice.org3.1/program/python DocumentConverter.py test.odt test.pdf

For windows:

"C:\Program Files\OpenOffice.org 3.1\program\python" DocumentConverter.py test.odt test.pdf

PyODConverter requires OpenOffice.org to be running as a service and listening on port (by default) 8100; the simplest way to start OpenOffice.org as a service is from the command line:

"C:\Program Files\OpenOffice.org 3.1\program\soffice" -accept="socket,port=8100;urp;"
share|improve this answer
add comment

Open Office is a good way forward, but the conversion fidelity is not always quite right.

If you are after a 100% Linux solution then that is the best way forward. However, if you don't mind a single Windows Box and write a little bit of code to interface with it from your Linux system then have a look at this post.

I wrote this post so the usual disclaimers apply.

share|improve this answer
add comment
  • Install OSE VirtualBox from the software center
  • Install Windows inside VirtualBox
  • Install MS Office in the virtual Windows
  • Install dopdf in the virtual Windows
  • Set dopdf as your default printer during the installation.
  • Open the *.doc in the virtual Office and print it to the dopdf virtual printer.
  • The *.pdf file will appear in the My Documents folder of the virtual Windows
  • Send it as email attachment to wherever you need to send it.
share|improve this answer
    
if you use MS Office just install "Save as PDF or XPS" microsoft.com/download/en/details.aspx?id=7 –  Remus Rigo Jul 14 '11 at 16:32
4  
This is a lot of trouble and unnecessary licenses for simple conversions that can be done natively in linux –  MaQleod Aug 5 '11 at 0:48
    
This is a Rube Goldberg machine. Don't use this. There are so many native ways to do it. –  Rob K Apr 10 at 15:54
add comment
  • Open -> Open Office (3.2 in my case)
  • Open Document you want to export
  • File->Export as PDF
  • Press: Export
  • Choose file name

Done and Done

share|improve this answer
    
Redundant answer. –  Isaac Rabinovitch Oct 22 '12 at 0:51
add comment

protected by Community Sep 20 '12 at 17:37

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?