This document is for an old version of FOP that is no longer supported. Latest version of this page
The Apache FOP Project

The Apache™ FOP Project

Upgrading from an Earlier Version of Apache™ FOP

Upgrading from Version 1.1

When upgrading from 1.x or earlier version of fop there are some significant changes that the user must be aware of:

FOUriResolver and FOPFactoryConfigurator classes have been removed

In their place, the following classes have been added:

Instead of configuring the FOPFactory you can use the above classes:

File xconf = new File("fop.xconf"); 
FopConfParser parser = new FopConfParser(xconf); //parsing configuration  
FopFactoryBuilder builder = parser.getFopFactoryBuilder(); //building the factory with the user options
FOPFactory fopFactory = builder.build();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);

or equally reading from an xml file

DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
Configuration cfg = cfgBuilder.buildFromFile(new File("mycfg.xml"));
fopFactoryBuilder = new FopFactoryBuilder(baseURI).setConfiguration(cfg);

The above can be used instead of fopFactory.setUserConfig(cfg) which is not available anymore.

Another important change is the way FOP resolves URI. Class FOURIResolver has been replaced with InternalResourceResolver (holds a reference to both the ResourceResolver needed for resource acquisition and the base URI from which to resolve URI's). ResourceResolverFactory (a factory class for Resource resolver).

Use of custom resource resolvers is now available through the use of FopFactoryBuilder.

FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI(), resolver);

resolver is an object of org.apache.xmlgraphics.io.ResourceResolver.

Instead of fopFactory.setURIResolver(uriResolver); where uriResolver is an object of URIResolver.

More information on how to configure Apache FOP programmatically and customizing the User Agent can be found in embedding

Moreover more information on providing org.apache.xmlgraphics.io.ResourceResolver for custom URI resolution can be found in servlets

Upgrading from Version 1.0

You should encounter very few issues in upgrading from FOP 1.0, except as noted in the following:

Upgrading from Pre-1.0 Versions

If you're planning to upgrade to the latest Apache™ FOP version from a pre-1.0 version, there are a few very important things to consider:

When you use your existing FO files or XML/XSL files which work fine with FOP version 0.20.5 against this FOP version some things may not work as expected. The following list will hopefully help you to identify and correct those problems.