Hi,

I use:

        FopFactoryBuilder confBuilder = new FopConfParser(fopxconf, new 
File(".").toURI()).getFopFactoryBuilder();
        FopFactory fopFactory = confBuilder.build();

Thanks

-----Original Message-----
From: Marcel Stör [mailto:mar...@frightanic.com] 
Sent: 30 June 2015 20:09
To: fop-users@xmlgraphics.apache.org
Subject: Migration code from 1.1 to 2.0

I've got a similar issue as asked in
http://markmail.org/message/cme6pd2wo54o4lci.

In 1.1 there was:

fopFactory = FopFactory.newInstance();
if (baseUrl != null) {
   fopFactory.setBaseURL(baseUrl.getURL().toExternalForm());
}
if (configLocation != null) {
   fopFactory.setUserConfig(configLocation.getURI().toString());
}

The closest I could replicate this for 2.0 is:

FopFactoryBuilder  fopFactoryBuilder = new FopFactoryBuilder(baseUrl.getURI());
if (configLocation != null) {
   DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
   try {
     Configuration cfg = cfgBuilder.buildFromFile(configLocation.getFile());
     fopFactoryBuilder.setConfiguration(cfg);
   } catch (ConfigurationException e) {
     throw new IOException("Failed to use FOP configuration at " + 
configLocation.getURL(), e);
   }
}
fopFactory = fopFactoryBuilder.build();

Is that ok? For the 2.0 version I had to ensure that my 'baseUrl' is never null 
because there doesn't seem to be a FopFactory/FopFactoryBuilder constructor 
which doesn't expect a base URL.

--
Marcel Stör, http://frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - http://bit.ly/1sNwXAM

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to