Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

migrated from Oct 20 '09 at 10:55

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

5 Answers 5

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.

share|improve this answer
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.

share|improve this answer

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

Word can open html files directly.

share|improve this answer

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

PyOpenOffice tool to convert SXW to PDF without using OOo

Convert Word --> Writer from the command line

Convert Excel -> PDF from the command line

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 you can get it here more discussion of it here...

Macro to save in three formats Macro to save backups with timestamps

Open HTML with Writer not Web in order to export
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.

share|improve this answer
no one works for me –  alcuadrado Oct 19 '09 at 16:21

I've just stumbled on this question and after a bit more googling, found pandoc:

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.