56

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

10 Answers10

35

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 distribution, try texlive-base plus texlive-latex-base:

sudo apt-get install wv texlive-base texlive-latex-base ghostscript  
wvPDF test.doc test.pdf
14

You can use:

oowriter -convert-to pdf:writer_pdf_Export doc_file.doc
Gareth
  • 19,080
12

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…

Tobu
  • 2,781
11

If you already install LibreOffice

lowriter --headless --convert-to pdf *.doc 
palswim
  • 3,601
camino
  • 307
11

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.

7

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

frabjous
  • 11,333
2

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;"
0

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.

0
  • 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

Jason
  • 11
-2
  • 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.
slhck
  • 235,242