Rich text format files (.rtf) was quite popular a while back.. remember Wordpad on Windows XP? If you look at the file format you will draw parallels to CSS, and back in 2005 I was looking at a smart way to publishing documents online. The thinking was that I could use Wordpad to create articles, and basically convert it to HTML/CSS.

Developing this conversion in PHP would have been too slow, and it had to be fast to do conversions on-the-fly (The choice was C++, and compiled on FreeBSD). I called it rtf2css back then, it is slightly misleading, its actually HTML and DIV tags with embedded styles.

The application will also extract embedded images in the RTF file to a directory of your choice, and you could nominate a URL to be used for image links. There are no HTML headers being outputed, so combind this application with some clever scripting and you can finally convert that huge collection of RTF files to HTML once and for all.

figure 1: HTML/CSS output rendered by Opera Web browser, and the original RTF file in Wordpad.

Using the tool

figure 2: Running the tool in Windows.

figure 3: Using PHP to generate a webpage using rtf2css

    print "<html>\n";
    print "  <head>\n";
    print "    <title>Saved my RTF collection..</title>\n";
    print "  </head>\n";
    print "  <body>\n";
    system("rtf2css.exe test.rtf");
    print "  </body>\n";
    print "</html>\n";


This tool was developed back in 2005, and has only been modified to allow the code to compile on Windows. You are free the to use this tool, and the source codes, but use at your own risk! It was never developed past beta version so it will most certainly not support the complete RTF specification.


Source codes has been updated to compiled for Windows using Mingw (GNU C++ 3.4.5) [UNKNOWN TAG:LINK:]


Download binaries/executable only (Windows):

Download source codes and executable (Windows & FreeBSD version):
Site maintained by
Page generated in: 0.0067 seconds.
Memory usage: 525184 bytes (peak: 551176 bytes)