TIP XslFoContrib is not installed on Foswiki.org.


FOP print formatter

This extension allows to publish structured content using XSL Formatting Objects (XSL-FO). It therefore leverages conversion of structured meta data from XML to PDF or RTF using a print formater such as Apache™ FOP.

As a print formatter Apache™ FOP is able to produce the resulting pages to a specified output. Output formats currently supported include

  • PDF,
  • PS, PCL,
  • AFP,
  • XML (area tree representation),
  • Print,
  • PNG,
  • RTF and
  • TXT.

The primary output target is PDF.

Conversion of content is primarily done using a wiki application that reads native Foswiki data to render it as XML which is then converted into XSL-FO using a XSLT style sheet.


The fop renderer itself is triggered by calling the fop service which then will process the content specified.

Url Parameter Description
section named section of the current topic to extract content from
format defines the output format, defaults to pdf
xsltopic topic holding the xsl transformation, defaults to the current topic
xslsection named section of the xsltopic to extract the transformation code from
xslattachment defines an attachment at the xsltopic holding the transformation file (specify either xslsection or xslattachment but not both)
filename optionally define the name of the file being generated, defaults to <current-topic>.<format>
template optionally define a view template to be used to render the FO content; content will be inserted to the template specifying a %TEXT% macro


Fo Mode

<?xml version="1.0" encoding="utf-8"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <fo:simple-page-master master-name="simple"
      <fo:region-body margin-top="3cm"/>
      <fo:region-before extent="3cm"/>
      <fo:region-after extent="1.5cm"/>

  <fo:page-sequence master-reference="simple">

    <fo:flow flow-name="xsl-region-body">

      <fo:block font-size="18pt"
        Hello, %WIKINAME%!

      <fo:block font-size="12pt"
                language="en" hyphenate="true">
        The Extensible Markup Language (XML) is a subset of SGML that is completely described in this document. Its goal is to
        enable generic SGML to be served, received, and processed on the Web in the way that is now possible with HTML. XML
        has been designed for ease of implementation and for interoperability with both SGML and HTML.


XSL mode


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/">
        <fo:simple-page-master master-name="A4-portrait"
              page-height="29.7cm" page-width="21.0cm" margin="2cm">
      <fo:page-sequence master-reference="A4-portrait">
        <fo:flow flow-name="xsl-region-body">
            Hello, <xsl:value-of select="name"/>!

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

30 Nov 2016: bundling latest fop-2.1; fixed encoding of content returned inline
02 Jul 2013: fixed url rewrite rules to use the current url host instead of the default url host
24 Jun 2013: initial release

Topic revision: r7 - 17 Sep 2018, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy