I need to convert PDF or HTML+CSS into DOC or DOCX under Linux, it can be from the command line or with a scripting language.

Any idea?


I've just stumbled on this question and after a bit more googling, found pandoc: http://johnmacfarlane.net/pandoc/README.html

A simple command will create a docx or pdf (or rtf etc) file from html input like so:

pandoc -o output.docx input.html

It can also write to stdout (with some formats) and read from stdin.

Not sure if it's in the debian / ubuntu repos but it's in the epel 6 repo for Redhat / CentOS 6 ( yum install pandoc ).

Hope this helps someone :)


You might be able to do the latter using OpenOffice from the command line. There are also bridges for Scripting languages - find out more on OpenOffice's website. There is one for PHP called PUNO, however I have no personal experience with it yet.

  • It parses HTML very badly, ignoring most of it's CSS – alcuadrado Oct 19 '09 at 16:22

You can convert HTML into .doc using an OpenOffice macro, see this thread:


converting pdf to .doc is much harder, due the multitude of different content that could be inside a PDF - quite often PDFs are used for things such as scanned text.


You can use pdftohtml to make an html file from a pdf.

Word can open html files directly.


Document Conversion

Current list of past examples.

Convert any document type into PDF

How convert Powerpoint slides to jpeg using openoffice api? (slide splitter)

List of many past conversion examples

Filter list

List of converters available in OOo 2.0 (1.9.x)? Instructions to produce filter list

Recursive Folder of Html into PDF,Txt,SXW,DOC

Recursive Folder of SXD to SDC (StarCalc 5)

Setting Image size for JPEG export

Xcel to Calc conversion using the API

A very similar one, converting Xcel to Text

Batch mode conversion

Document conversion

VB: converting Excel files to txt files

General Visual Basic document conversion of Text...

Converting Word -> PDF from the command line http://www.oooforum.org/forum/viewtopic.php?t=3772 http://www.oooforum.org/forum/viewtopic.php?t=5513 http://www.oooforum.org/forum/viewtopic.php?t=3768

PyOpenOffice tool to convert SXW to PDF without using OOo

Convert Word --> Writer from the command line

Convert Excel -> PDF from the command line

http://www.oooforum.org/forum/viewtopic.php?t=5596 http://www.oooforum.org/forum/viewtopic.php?p=21050#21050

Convert SXC to CSV from commandline

Convert PPT to HTML from command line...

Convert PPT to HTML short example...

Convert PPT to PDF short example...

see tail end of thread...

Converting SXW -> PDF

Draw export to PDF

In Python...

Thread about converting document to PDF in Java

Convert SXW to DOC with Java

I wrote a batch document converter
http://www.oooforum.org/forum/viewtopic.php?t=3525 http://www.oooforum.org/forum/viewtopic.php?t=2810 http://www.oooforum.org/forum/viewtopic.php?p=10311#10311 you can get it here
http://www.ooomacros.org/user.php#95532 more discussion of it here...

Macro to save in three formats
http://www.oooforum.org/forum/viewtopic.php?t=3612 Macro to save backups with timestamps

Open HTML with Writer not Web in order to export
http://www.oooforum.org/forum/viewtopic.php?t=3973 http://www.oooforum.org/forum/viewtopic.php?p=44367#44367
How to convert HTML into OpenOffice File?
Page size pblm when converting HTML to PDF

Discussion that ends in DocConverter utility.

Convert DBF into XLS, SXC, PDF and HTML

Good Visual Basic code example...converting documents

Draw exporting and printing

Using OOo's source code to read / convert / write documents in the formats supported by its filters. http://www.oooforum.org/forum/viewtopic.php?t=5785

  • 1
    no one works for me – alcuadrado Oct 19 '09 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy