7

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?

5 Answers 5

7

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

1

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.

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

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

http://www.oooforum.org/forum/viewtopic.phtml?p=44367#44367

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.

1

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

Word can open html files directly.

-1

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
http://www.oooforum.org/forum/viewtopic.phtml?p=81846#81846

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...
http://www.oooforum.org/forum/viewtopic.php?t=5708

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

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?
http://www.oooforum.org/forum/viewtopic.php?t=11580
Page size pblm when converting HTML to PDF
http://www.oooforum.org/forum/viewtopic.phtml?p=63682#63682

Discussion that ends in DocConverter utility.
http://www.oooforum.org/forum/viewtopic.php?t=2668

Convert DBF into XLS, SXC, PDF and HTML
http://www.oooforum.org/forum/viewtopic.php?t=5728

Good Visual Basic code example...converting documents
http://www.oooforum.org/forum/viewtopic.php?t=7673

Draw exporting and printing
http://www.oooforum.org/forum/viewtopic.php?t=3620

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
  • 1
    no one works for me
    – alcuadrado
    Oct 19, 2009 at 16:21

You must log in to answer this question.