PyRTF - Rich Text Format (RTF) Document Generation in Python

Site Opened on 24th July 2004

Head on over to downloads to grab PyRTF.

9th May 2005: Release 0.45

I have added support for JPG and PNG images. Thanks go to Jeff Bricker for kicking it along in this regard.

4th May 2005: Release 0.44

Bug fix for documents with lots of sections, few more keyword parameters added to make things a bit easier to use and added support for merging cells in tables.

Check out the README for all the gory details.

Brief Description

PyRTF is a set of python classes that make it possible to produce RTF documents from python programs. The library has no external dependancies and in my own testing has proved reliable and fast. Three examples are included in the release that demonstrate some of the features of the library, I'll be adding to these when I can.

PyRTF has been tested on the following OS's; W2K, WinXP, GNU/Linux, OpenBSD, FreeBSD and on the following Word Processors; OpenOffice, Word95, Word97, Word2000, WordXP and MacWord (not sure which version).



A standard style sheet is provided but custom style sheets can be created which makes it possible to create suites of documents that conform to organisational guidelines.

Styles can be overridden down to almost any level, so the basic structure of the document can rely on the style sheet and only those areas that need to be different can be modified. For example bold, italic, underlining, etc can be applied to only the text items that require it.

Document Sections

Documents can contain multiple sections, each section can have its own page size, style sheet, header and footer. Headers and footers that apply only to the first page of a section are supported.


There is extensive support for tables, almost all of the table features provided by RTF are represented in PyRTF. Tables are built up from earlier building blocks so once you are familiar with the basics, tables are relatively easy to handle.


PNG and JPG images are supported.

To Do

The following is in no particular order.


PyRTF is licenced under the GPL and the LGPL.


Donate to this project Donate to PyRTF

Go on, you'll be helping to add documentation, examples, unit tests and features to PyRTF, and it will make you feel all warm and fuzzy that you have contributed to a worthy project ;-) Logo

Old News

30th August 2004: Release

Includes one extra example that demonstrates changing the colour of text. Also cleans up the a bit and includes the new licencing info. Also included the package on PyPI.

16th August 2004: Licence Change

After user feedback I have decided to change to a dual licencing arrangement. I have added the LGPL as a licencing option. I hope that users of PyRTF will now feel free to redistribute PyRTF with their commercial applications if they so desire.

None of the code has changed so keep using version 0.42, I'll include the new licencing information, etc the next time that I change the code and do a release.

25th July 2004: First Release

Just did a first release, head on over to downloads to grab it.