Source src = new StreamSource(foFile);
Transformer transformer = replicatorTemplates.newTransformer();
transformer.setParameter("repeats", new Integer(replicatorRepeats));
OutputStream out = new NullOutputStream(); //write to /dev/nul
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setBaseURL(foFile.getParentFile().toURL().toExternalForm());
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
Result res = new SAXResult(fop.getDefaultHandler());