*/
public void convertToIntermediate(Source src, Source xslt, File intermediate)
throws IOException, FOPException, TransformerException {
//Create a user agent
FOUserAgent userAgent = fopFactory.newFOUserAgent();
//Create an instance of the target document handler so the IFSerializer
//can use its font setup
IFDocumentHandler targetHandler = userAgent.getRendererFactory().createDocumentHandler(
userAgent, MimeConstants.MIME_PDF);
//Create the IFSerializer to write the intermediate format
IFSerializer ifSerializer = new IFSerializer();
ifSerializer.setContext(new IFContext(userAgent));
//Tell the IFSerializer to mimic the target format
ifSerializer.mimicDocumentHandler(targetHandler);
//Make sure the prepared document handler is used
userAgent.setDocumentHandlerOverride(ifSerializer);
// Setup output
OutputStream out = new java.io.FileOutputStream(intermediate);
out = new java.io.BufferedOutputStream(out);
try {