FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
foUserAgent.setCreationDate(new Date(10000));
MessageDigest outDigest = MessageDigest.getInstance("MD5");
DigestOutputStream out =
new DigestOutputStream(new ByteArrayOutputStream(), outDigest);
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
InputSource source = new InputSource(new StringReader(fo));
DigestFilter filter = new DigestFilter("MD5");
filter.setParent(parserFactory.newSAXParser().getXMLReader());
filter.setContentHandler(fop.getDefaultHandler());
filter.parse(source);
String digestInActual = digestToString(filter.getDigestValue());
if (!digestIn.equals(digestInActual)) {
fail("input MD5: was " + digestInActual + ", expected " + digestIn);
}