Search in sources :

Example 1 with FopConfParser

use of org.apache.fop.apps.FopConfParser in project pcgen by PCGen.

the class FopTask method createFopFactory.

private static FopFactory createFopFactory() {
    // Allow optional customization with configuration file
    String configPath = ConfigurationSettings.getOutputSheetsDir() + File.separator + "fop.xconf";
    Logging.log(Logging.INFO, "FoPTask checking for config file at " + configPath);
    File userConfigFile = new File(configPath);
    FopFactoryBuilder builder;
    if (userConfigFile.exists()) {
        Logging.log(Logging.INFO, "FoPTask using config file " + configPath);
        FopConfParser parser;
        try {
            parser = new FopConfParser(userConfigFile);
        } catch (Exception e) {
            Logging.errorPrint("FoPTask encountered a problem with FOP configuration " + configPath + ": ", e);
            return null;
        }
        builder = parser.getFopFactoryBuilder();
    } else {
        Logging.log(Logging.INFO, "FoPTask using default config");
        builder = new FopFactoryBuilder(new File(".").toURI());
        builder.setStrictFOValidation(false);
    }
    return builder.build();
}
Also used : FopConfParser(org.apache.fop.apps.FopConfParser) FopFactoryBuilder(org.apache.fop.apps.FopFactoryBuilder) File(java.io.File) TransformerException(javax.xml.transform.TransformerException) FOPException(org.apache.fop.apps.FOPException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 TransformerException (javax.xml.transform.TransformerException)1 FOPException (org.apache.fop.apps.FOPException)1 FopConfParser (org.apache.fop.apps.FopConfParser)1 FopFactoryBuilder (org.apache.fop.apps.FopFactoryBuilder)1