*/
// create the in/output stream for the generation
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FopFactory fopFactory = ApacheFopFactory.instance();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, baos);
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();
Reader reader = new StringReader(writer.toString());
Source src = new StreamSource(reader);
Result res = new SAXResult(fop.getDefaultHandler());
// Start XSLT transformation and FOP processing
transformer.transform(src, res);
// and generate the PDF
baos.flush();
baos.close();
// We don't want to cache the images that get loaded by the FOP engine
fopFactory.getImageFactory().clearCaches();
// store in the list of maps for sendmail....
List bodyParts = FastList.newInstance();
if (bodyText != null) {
bodyText = FlexibleStringExpander.expandString(bodyText, screenContext, locale);