Hope to see you there!
Hope to see you there!
The Apache™ 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/fop.xconf 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.
After creating your configuration file, you must tell FOP how to find it:
If running FOP from the command-line, see the "-c" command-line option inRunning FOP.
If running FOP as an embedded application, seeEmbedding, Using a Configuration File.
SeeSetting the Configuration Programmatically for instructions on how to do so in an embedded environment.
| Element | Data Type (for the value) | Description | Default Value |
|---|---|---|---|
| base1 | URL or directory | Specifies the base URL based on which relative URL will be resolved. | current directory |
| font-base1 | URL or directory | Specifies the base URL based on which relative font URLs will be resolved. | base URL/directory (above) |
| hyphenation-base1 | URL or directory | Specifies the base URL based on which relative URLs to hyphenation pattern files will be resolved. If not specified, support for user-supplied hyphenation patterns remains disabled. | disabled |
| hyphenation-pattern | String, attribute lang, attribute country (optional) | Register a file name for the hyphenation pattern for the mentioned language and country. Language ll and country CC must both consist of two letters. | ll_CC |
| source-resolution | Integer, dpi | Resolution in dpi (dots per inch) which is used internally to determine the pixel size for SVG images and bitmap images without resolution information. | 72 dpi |
| target-resolution | Integer, dpi | Resolution in dpi (dots per inch) used to specify the output resolution for bitmap images generated by bitmap renderers (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter effects and such. | 72 dpi |
| strict-configuration | Boolean (true, false) | Setting this option to 'true' will cause FOP to strictly verify the contents of the FOP configuration file to ensure that defined resources (such as fonts and base URLs/directories) are valid and available to FOP. Any errors found will cause FOP to immediately raise an exception. | false |
| strict-validation | Boolean (true, false) | Setting this option to 'false' causes FOP to be more forgiving about XSL-FO validity, for example, you're allowed to specify a border on a region-body which is supported by some FO implementations but is non-standard. Note that such a border would currently have no effect in Apache FOP. | true |
| break-indent-inheritance | Boolean (true, false) | Setting this option to 'true' causes FOP to use an alternative rule set to determine text indents specified through margins, start-indent and end-indent. Many commercial FO implementations have chosen to break the XSL specification in this aspect. This option tries to mimic their behaviour. Please note that Apache FOP may still not behave exactly like those implementations either because FOP has not fully matched the desired behaviour and because the behaviour among the commercial implementations varies. The default for this option (i.e. false) is to behave exactly like the specification describes. | false |
| complex-scripts | attribute disabled (optional) | If present and if an attribute 'disabled' is specified with the value 'false', then complex script features are disabled. The same result can be obtained on an FOP per-invocation basis by specifying a '-nocs' command line option when invoking FOP. When complex script features are disabled, all bidirectional processing and complex character to glyph mapping processing is disabled; in addition, the loading of GDEF, GSUB, and GPOS advanced typographic tables is disabled for OpenType and TrueType fonts. Unless disabled by this mechanism or by use of the '-nocs' command line option, complex script features will be enabled by default. | n/a |
| default-page-settings | n/a | Specifies the default width and height of a page if "auto" is specified for either or both values. Use "height" and "width" attributes on the default-page-settings element to specify the two values. | "height" 11 inches, "width" 8.26 inches |
| prefer-renderer | boolean (true, false) | By default, FOP prefers the newer output implementations based on theIFDocumentHandler interface. If no such implementation can be found for a given MIME type, it looks for an implementation of theRenderer interface. If necessary, you can invert the lookup order to prefer the Renderer variant over the IFDocumentHandler variant by setting this value to true. | false |
| use-cache | boolean (true, false) | All fonts information that has been gathered as a result of "directory" or "auto-detect" font configurations will be cached for future rendering runs. This setting should improve performance on systems where fonts have been configured using the "directory" or "auto-detect" tag mechanisms. By default this option is switched on. | true |
| cache-file | String | This option specifies the file/directory path of the fop cache file. This file is currently only used to cache font triplet information for future reference. | ${base}/conf/fop.cache |
| table-border-overpaint | Boolean (true, false) | Setting this option to 'true' will cause FOP to produce table borders without uneven lines | false |
| simple-line-breaking | Boolean (true, false) | Setting this option to 'true' will cause FOP to use a faster line breaking algorithm | false |
| renderers | (see text below) | Contains the configuration for each renderer. See below. | N/A |
| skip-page-position-only-allowed | Boolean (true, false) | Controls output of 'blank' pages.See below. | true |
This is an excerpt from the example configuration file coming with FOP:
<fopversion="1.0"><!-- Strict user configuration --><strict-configuration>true</strict-configuration><!-- Strict FO validation --><strict-validation>true</strict-validation><!-- Base URL for resolving relative URLs --><base>./</base><!-- Font Base URL for resolving relative font URLs --><font-base>./</font-base><!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi --><source-resolution>72</source-resolution><!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi --><target-resolution>72</target-resolution><!-- default page-height and page-width, in case value is specified as auto --><default-page-settingsheight="11in"width="8.26in"/><!-- Use file name nl_Bel instead of the default nl_BE --><hyphenation-patternlang="nl"country="BE">nl_Bel</hyphenation-pattern><!-- or for xml file --><hyphenation-patternlang="fr"extension="xml">lang/fr.xml</hyphenation-pattern><!-- or for binary file --><hyphenation-patternlang="fr"extension="hyp">lang/fr.hyp</hyphenation-pattern><!-- etc. etc..... --></fop>Apache FOP uses the image loading framework fromApache XML Graphics Commons to load images using various plug-ins. Every image loader plug-in has a hard-coded usage penalty that influences which solution is chosen if there are multiple possibilities to load an image. Sometimes, though, these penalties need to be tweaked and this can be done in the FOP configuration. An example:
<fopversion="1.0"> [..]<image-loading><penaltyvalue="10000"class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawCCITTFax"/><penaltyvalue="INFINITE"class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderInternalTIFF"/></image-loading><renderers....</fop>The first penalty element increases the penalty for the raw CCITT loader. This practically forces the decoding of CCITT compressed TIFF images except if there are no TIFF codecs available.
The second penalty element sets an "infinite" penalty for the TIFF loader using the internal TIFF codec. This practically disables that plug-in as it will never be chosen as a possible solution.
Negative penalties are possible to promote a plug-in but a negative penalty sum will be treated as zero penalty in most cases. For more details on the image loading framework, please consult the documentation there.
The ImageLoaderPNG and ImageLoaderRawPNG have a hard-coded penalty of 1000 and as such the ImageLoaderImageIO image loader will be selected by default when loading PNGs unless the latter is disabled by awarding a INFINITE penalty to it, or one of the former two is promoted by awarding a strong negative penalty (say, -10000) to it.
<fopversion="1.0"> [..]<image-loading><penaltyvalue="-10000"class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawPNG"/><penaltyvalue="INFINITE"class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderPNG"/><penaltyvalue="INFINITE"class="org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO"/></image-loading><renderers....</fop>Each Renderer has its own configuration section which is identified by the MIME type the Renderer is written for, ex. "application/pdf" for the PDF Renderer.
The configuration for the PDF Renderer could look like this:
<renderers><renderermime="application/pdf"><filterList><!-- provides compression using zlib flate (default is on) --><value>flate</value></filterList><fonts><fontmetrics-url="arial.xml"kerning="yes"embed-url="arial.ttf"><font-tripletname="Arial"style="normal"weight="normal"/><font-tripletname="ArialMT"style="normal"weight="normal"/></font><fontmetrics-url="arialb.xml"kerning="yes"embed-url="arialb.ttf"><font-tripletname="Arial"style="normal"weight="bold"/><font-tripletname="ArialMT"style="normal"weight="bold"/></font></fonts></renderer><renderermime="application/postscript"><!-- etc. etc..... -->The details on the font configuration can be found on the separateFonts page. Note especially the section entitledRegister Fonts with FOP.
The configuration element for the PDF renderer contains two elements. One is for the font configuration (please follow the link above) and one is for the "filter list". The filter list controls how the individual objects in a PDF file are encoded. By default, all objects get "flate" encoded (i.e. simply compressed with the same algorithm that is also used in ZIP files). Most users don't need to change that setting. For debugging purposes, it may be desired not to compress the internal objects at all so the generated PDF commands can be read. In that case, you can simply use the following filter list. The second filter list (type="image") ensures that all images still get compressed but also ASCII-85 encoded so the produced PDF file is still easily readable in a text editor.
<renderermime="application/pdf"><filterList><value>null</value></filterList><filterListtype="image"><value>flate</value><value>ascii-85</value></filterList><fonts....</renderer>Another (optional) setting specific to the PDF Renderer is an output color profile, an ICC color profile which indicates the target color space the PDF file is generated for. This setting is mainly used in conjunction with thePDF/X feature. An example:
<renderermime="application/pdf"><filterList...<output-profile>C:\FOP\Color\EuropeISOCoatedFOGRA27.icc</output-profile><fonts....</renderer>Some people don't have high requirements on color fidelity but instead want the smallest PDF file sizes possible. In this case it's possible to disable the default sRGB color space which XSL-FO requires. This will cause RGB colors to be generated as device-specific RGB. Please note that this option is unavailable (and will cause an error) if you enable PDF/A or PDF/X functionality or if you specify an output profile. This setting will make the PDF about 4KB smaller. To disable the sRGB color space add the following setting:
<renderermime="application/pdf"><filterList...<disable-srgb-colorspace>true</disable-srgb-colorspace><fonts....</renderer>FOP supports encryption of PDF output, thanks to Patrick C. Lankswert. This feature is commonly used to prevent unauthorized viewing, printing, editing, copying text from the document and doing annotations. It is also possible to ask the user for a password in order to view the contents. Note that there already exist third party applications which can decrypt an encrypted PDF without effort and allow the aforementioned operations, therefore the degree of protection is limited. For further information about features and restrictions regarding PDF encryption, look at the documentation coming with Adobe Acrobat or the technical documentation on the Adobe web site.
<renderermime="application/pdf"><encryption-params><encryption-length>128</encryption-length><user-password>testuserpass</user-password><owner-password>testownerpass</owner-password><noprint/><nocopy/><noedit/><noannotations/><nofillinforms/><noaccesscontent/><noassembledoc/><noprinthq/></encryption-params></renderer>By default FOP produces PDF files of version 1.4, but this can be changed in order to benefit from features that appeared in newer versions of PDF. At the moment, only a few features from PDF 1.5 have been implemented, but the configuration element will accept any value between 1.4 and 2.0. This is the value that will appear in the PDF header, although only features up to 1.5 will actually be used.
<renderermime="application/pdf"><version>1.5</version><!-- Versions 1.4, 1.5, 1.6, 1.7 and 2.0 are accepted, all other values are invalid --></renderer>Besides the normal font configuration (the same "fonts" element as for the PDF renderer) the PostScript renderer has an additional setting to force landscape pages to be rotated to fit on a page inserted into the printer in portrait mode. Set the value to "true" to activate this feature. The default is "false". Example:
<renderermime="application/postscript"><auto-rotate-landscape>true</auto-rotate-landscape><fonts><fontmetrics-url="arial.xml"kerning="yes"embed-url="arial.ttf"><font-tripletname="Arial"style="normal"weight="normal"/><font-tripletname="ArialMT"style="normal"weight="normal"/></font><fontmetrics-url="arialb.xml"kerning="yes"embed-url="arialb.ttf"><font-tripletname="Arial"style="normal"weight="bold"/><font-tripletname="ArialMT"style="normal"weight="bold"/></font></fonts></renderer>Non-standard fonts for the PCL renderer are made available through the Java2D subsystem which means that you don't have to do any custom font configuration in this case but you have to use the font names offered by Java.
Additionally, there are certain settings that control how the renderer handles various elements.
<renderermime="application/x-pcl"><rendering>quality</rendering><text-rendering>bitmap</text-rendering></renderer>The default value for the "rendering" setting is "speed" which causes borders to be painted as plain rectangles. In this mode, no special borders (dotted, dashed etc.) are available. If you want support for all border modes, set the value to "quality" as indicated above. This will cause the borders to be painted as bitmaps.
The default value for the "text-rendering" setting is "auto" which paints the base fonts using PCL fonts. Non-base fonts are painted as bitmaps through Java2D. If the mix of painting methods results in unwelcome output, you can set this to "bitmap" which causes all text to be rendered as bitmaps.
Additionally, there are certain settings that control how the renderer handles various elements.
<renderermime="application/x-afp"><imagesmode="b+w"bits-per-pixel="8"native="true"/><renderer-resolution>240</renderer-resolution><line-width-correction>2.5</line-width-correction><!-- a default external resource group file --><resource-group-file>resources.afp</resource-group-file></renderer>The default value for the images "mode" setting is "b+w" (black and white). When the images "mode" setting is "b+w" a "bits-per-pixel" setting can be provided to aid the grayscale conversion process. With this setting all images referenced in your source document are converted to an IOCA FS45 grayscale bitmap image form. When the setting is "color" all images are converted to an IOCA FS45 color bitmap image form. When "native" setting is "true", all images encountered (TIFF, GIF, JPEG and Encapsulated Postscript etc.) will be embedded directly in the datastream in their native form using a MO:DCA Object Container.
The default value for the "renderer-resolution" is 240 dpi.
The default line width is device dependent and may need to be fine tuned so that the output matches the expected result. The default correction value is 2.5.
By default if there is no configuration definition for "resource-group-file", external resources will be placed in a file called resources.afp.
When set to false, a second page with no content in the body (but other content such as region-after) may be produced when a conditional-page-master-reference with page-position="only" is a master candidate.
Ordinarily (i.e. when this setting not set to false), the processor will consider using conditional-page-master-references with page-position="only" one time only; if it fails to successfully construct the document on the first attempt, these conditional-page-master-references are ignored in further attempts. This default behaviour avoids the output of a 'blank' page - a second page with no content in the body where the processor fails to fit all the content onto a single page. In some cases however, this final page devoid of any body content is required and setting skip-page-position-only-allowed to false will allow this second page with no body content to be output.
A specific example of the use of this flag is where a simple-page-master with page-position="only" specifies a large region-after and the amount of content is such that the processor cannot quite fit the body content and the large region-after onto one page. The processor will then produce a second page and fall back to using alternative simple-page-masters which have smaller region-afters and so the content and smaller region-after will fit on the first page and the second page will have no content in the body. The default behaviour will be to suppress that second page with no body content. But if skip-page-position-only-allowed is set to false the second page will be produced.
FOP searches the configuration file for the information it expects, at the position it expects. When that information is not present, FOP will not complain, it will just continue. When there is other information in the file, FOP will not complain, it will just ignore it. That means that when your configuration information is in the file but in a different XML element, or in a different XML path, than FOP expects, it will be silently ignored.
Check the following possibilities:
The format of the configuration file has changed considerably between FOP 0.20.5 and FOP 1.0 and its beta versions. Did you convert your file to the new format?
The FOP distribution contains a schema for configuration files, at src/foschema/fop-configuration.xsd. Did you validate your configuration file against it? Add the following schema location to theschema element:
<fop xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/src/foschema/fop-configuration.xsd?view=co">
and run the configuration file through a validating schema parser. Note that the schema cannot detect all errors, and that it is stricter about the order of some elements than FOP itself is.
-d). This makes FOP report which configuration information it finds. Check if FOP finds what you expect.Copyright © 2025 The Apache Software Foundation, Licensed undertheApache License, Version 2.0.
Apache, Apache XML Graphics, Apache FOP, Apache Batik, the Apache logo, and theApache XML Graphics logos are trademarks ofThe ApacheSoftware Foundation. All other marks mentioned may be trademarks or registeredtrademarks of their respective owners.