47
22
I have a set of files in .doc format, that need to be converted to .pdf format. I am using Ubuntu linux.
47
22
I have a set of files in .doc format, that need to be converted to .pdf format. I am using Ubuntu linux.
33
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
wvPDF
not found in Lubuntu, wv
version 1.2.9-4.2
is installed – Timo – 2018-05-14T14:40:21.437
1in 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 – 2011-08-08T18:40:49.593
How can I change the ~/PDF path to somewhere else ? – hd. – 2013-01-13T05:05:24.930
3OpenOffice is generally now replaced with LibreOffice, so the command is lowriter
– user60561 – 2014-03-07T01:05:14.567
3for LibreOffice, the command is
lowriter --convert-to pdf your_word_file.doc
and the default is to output in the current directory. – GreyBeardedGeek – 2014-05-19T02:43:11.817
14
You can use:
oowriter -convert-to pdf:writer_pdf_Export doc_file.doc
2Short 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 – 2012-01-21T04:05:31.543
For Libreoffice, this works: writer -convert-to pdf:writer_pdf_Export file.docx
– kolypto – 2012-07-03T15:08:36.293
3On 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 – 2012-09-06T23:05:46.453
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 – 2013-06-28T12:24:27.547
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.
10
Agreed that this is the best answer. A better answer however, would be one that was as simple as this, but did not require installing the gigantic libreoffice. – speedplane – 2016-03-22T08:28:41.510
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. – None – 2010-06-24T11:07:25.127
Wow this does a lot more than that. For example you can convert html, doc, docx and more to pdf. For example to convert from html to pdf run unoconv --output output.pdf myHtmlPage.html
– Tono Nam – 2019-10-24T02:58:43.933
This is the best solution, it totally handles talking to LibreOffice for you. – thirtythreeforty – 2013-10-11T02:53:25.200
8
If you already install LibreOffice
lowriter --headless --convert-to pdf *.doc
5
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
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
Done and Done
Redundant answer. – Isaac Rabinovitch – 2012-10-22T00:51:20.027
-3
dopdf
in the virtual Windowsdopdf
as your default printer during the installation. *.doc
in the virtual Office and print it to the dopdf
virtual printer. *.pdf
file will appear in the My Documents
folder of the virtual Windowsif you use MS Office just install "Save as PDF or XPS" http://www.microsoft.com/download/en/details.aspx?id=7
– Remus Rigo – 2011-07-14T16:32:41.3307This is a lot of trouble and unnecessary licenses for simple conversions that can be done natively in linux – MaQleod – 2011-08-05T00:48:45.463
This is a Rube Goldberg machine. Don't use this. There are so many native ways to do it. – Rob K – 2014-04-10T15:54:08.103
possible duplicate of Batch-convert Word-documents to PDF's (free)
– Ƭᴇcʜιᴇ007 – 2014-12-04T19:20:24.267