}
return null;
}
public File postProcessResult(File result) throws MojoExecutionException {
final FopFactory fopFactory = FopFactory.newInstance();
final FOUserAgent userAgent = fopFactory.newFOUserAgent();
// First transform the cover page
transformCover();
// Get properties file from webhelp war
String warBasename = result.getName().substring(0, result.getName().lastIndexOf('.'));
Properties properties = new Properties();
InputStream is;
try {
File f = new File(projectBuildDirectory, "autopdf/pdf.properties");
is = new FileInputStream( f );
properties.load(is);
}
catch ( Exception e ) {
System.out.println("Got an Exception: " + e.getMessage());
}
// FOUserAgent can be used to set PDF metadata
Configuration configuration = loadFOPConfig();
InputStream in = null;
OutputStream out = null;
File targetPdfFile = null;
try
{
String baseURL = sourceDirectory.toURI().toURL().toExternalForm();
baseURL = baseURL.replace("file:/", "file:///");
userAgent.setBaseURL(baseURL);
if (getLog().isDebugEnabled()) {
getLog().debug("Absolute path is "+baseURL);
}
in = new FileInputStream(result);
targetPdfFile = new File (result.getAbsolutePath().replaceAll(".fo$", properties.getProperty("pdfsuffix","") + ".pdf"));
out = new FileOutputStream(targetPdfFile);
fopFactory.setUserConfig(configuration);
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
// Setup JAXP using identity transformer
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(); // identity transformer