transformer = tFactory.newTransformer();
}
//Set up XMLRenderer to render to a DOM
TransformerHandler handler = tFactory.newTransformerHandler();
DOMResult domResult = new DOMResult();
handler.setResult(domResult);
FOUserAgent userAgent = createUserAgent();
//Create an instance of the target renderer so the XMLRenderer can use its font setup
Renderer targetRenderer = userAgent.getRendererFactory().createRenderer(
userAgent, MimeConstants.MIME_PDF);
XMLRenderer renderer = new XMLRenderer();
renderer.mimicRenderer(targetRenderer);
renderer.setContentHandler(handler);
renderer.setUserAgent(userAgent);
userAgent.setRendererOverride(renderer);
Fop fop = fopFactory.newFop(MimeConstants.MIME_FOP_AREA_TREE, userAgent);
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res);
return (Document)domResult.getNode();
}