* @throws Exception if the conversion fails
*/
protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile)
throws Exception {
ByteArrayOutputStream baout = new ByteArrayOutputStream();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, ua, baout);
Transformer transformer = tFactory.newTransformer();
Source src = new StreamSource(foFile);
SAXResult res = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res);
final byte[] result = baout.toByteArray();
if (dumpPdfFile) {
final File outFile = new File(foFile.getParentFile(), foFile.getName() + ".pdf");
FileUtils.writeByteArrayToFile(outFile, result);