PyODConverter

PyODConverter, for Python OpenDocument Converter, is a Python script that automates office document conversions from the command line using OpenOffice.org.

The script does basically the same thing as the command line tool that comes with JODConverter but is much simpler. In fact the Python script was released for the people who use JODConverter only from the command line (not as a Java library or web service) and would like a simpler alternative.

Usage

Just like JODConverter, PyODConverter requires OpenOffice.org to be running as a service and listening on port (by default) 8100; the simples way to start OpenOffice.org as a service is from the command line

> "C:\Program Files\OpenOffice.org 2.2\program\soffice" -accept="socket,port=8100;urp;"

The script expects exactly 2 parameters: an input and an output file names. The document formats are inferred from the file extensions.

Since it uses the Python/UNO bridge, the script requires the UNO modules to be already present in your Python installation. Most of the time this means you need to use the Python version installed with OpenOffice.org, e.g. on Windows

> "C:\Program Files\OpenOffice.org 2.2\program\python" DocumentConverter.py test.odt test.pdf

or on Linux

$ /opt/openoffice.org2.2/program/python DocumentConverter.py test.odt test.pdf

If you want to write your own scripts in Python, PyODConverter can also act as a Python module, exporting a DocumentConverter class with a very simple API.

Download

PyODConverter v1.0.0 is a single Python script and can be downloaded directly from here: DocumentConverter.py [5.3kb]

PyODConverter is distributed under the terms of the GNU LGPL (just like OpenOffice.org).

ChangeLog

v1.0.0 - 2008-05-05

  • Let OOo determine the input document type, rather than using the file extension. This means all OOo-supported input types should now be accepted without any additional configuration.