TIP RtfContrib is not installed on Foswiki.org.


Extension to translate Foswiki markup to RTF


The current use is restricted to exporting wiki content from a topic and insert it into a RTF template file. This template file contains tags like %FORMFIELD{"FirstName"}% and %TEXT% which are replaced with the data extracted from the current topic. When you call the rtf CGI script on a topic like this
the script will use the RTF template user-form.rtf attached to the topic Main.UserForm and process it as outlined. The result is then cached in a configurable CacheDir under the name Hello.rtf in addition to sending it to the browser. Your browser can be configured to open up the received file with an appropriate word processing tool.

Template tags

The following tags are replaced with data drawn from a topic
Name Description
%TEXT% topic text
%SECTION{"name"}% named topic section
%FORMFIELD{"name"}% formfield of an attched DataForm
%ATTACHMENT{"name" format="..."}% information about attached files
%IMAGE{"url"}% inserts an image downloaded from the given url; supported image formats are jpeg, png, ...

Customizing RTF output

The basic layout of the RTF output is specified by an RTF file that serves as a template. So you have the freedom to create such a document as you like. This extension comes with a few predefined templates that might help you to adjust them to you own needs.

In addition there are some preference variables that determine the formatting of output generate while translating Foswiki markup to RTF.

  • headings: ...
  • lists: ...
  • ...


  • $Foswiki::cfg{RtfContrib}{Debug}: debugging flag, defaults to 0
  • $Foswiki::cfg{RtfContrib}{CacheDir}: directory where generated RTF files are cached, defaults to /pub/System/RtfContrib
  • $Foswiki::cfg{RtfContrib}{DefaultRtfTemplate}: RTF file used as a template to create the final RTF file from it when exporting a topic, this can be overriden using the template urlparam on the rtf CGI call

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.



Change History

16 Jan 2017: adjustments due to latest api changes in DBCachePlugin
09 Sep 2016: added missing Config.spec file
29 Aug 2014: fully specify rest security
12 Feb 2010: language support in RTF templates
Topic revision: r7 - 16 Jan 2017, MichaelDaum - This page was cached on 13 Feb 2017 - 18:46.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License