Apache XML FOP

the Apache XML site

FOP: Configuration


Configuration File Basics

The FOP configuration file is an XML file containing a variety of settings that are useful for controlling FOP's behavior, and for helping it find resources that you wish it to use.

The easiest way to get started using a FOP configuration file is to copy the sample found at {fop-dir}/conf/userconfig.xml to a location of your choice, and then to edit it according to your needs. It contains templates for the various configuration options, most of which are commented out. Remove the comments and change the settings for entries that you wish to use. Be sure to follow any instructions, including comments which specify the value range. Also, since the configuration file is XML, be sure to keep it well-formed.

Do not change {fop-dir}/conf/config.xml or use it as the basis for your configuration file. It has an entirely different purpose.

Creating Entries

The general structure of the configuration file is a series of <entry> tags, each containing a <key> and a <value>. (Fonts use a different format). Here is an example:


Making Configuration Available to FOP

After creating your configuration file, you must tell FOP how to find it:

See Setting the Configuration Programmatically for instructions on how to do so in an embedded environment.

Summary of Key-Value Configuration Options

Option (key) Data Type (for the value) Default Value
baseDir URL For command-line, the directory containing the input FO or XML file. For embedded, the current working directory.
fontBaseDir URL value of baseDir
hyphenation-dir URL None. This is for custom hyphenation patterns.
strokeSVGText Boolean True

Detail for Key-Value Configuration Options

The sections below provide detailed information for configuration options that are not self-explanatory. The parenthetical information after each key name indicates (Data Type, Default).

hyphenation-dir (URL, none)

Use this entry to indicate a directory containing custom hyphenation files (if any). See FOP: Hyphenation for more information on creating and modifying hyphenation within FOP.

strokeSVGText (boolean, True)

In some cases, some text in SVG documents is converted to graphical shapes instead of retaining its character as text. To force all text to be rendered as text, set strokeSVGText = false. For a discussion of this issue, see FOP: Graphics, Placing SVG Text into PDF.

strokeSVGText is currently only effective in the PDF renderer.


Font configuration information is included in the FOP configuration file, but is documented at FOP: Fonts. Note especially the section entitled Register Fonts with FOP.