[jdom-interest] jdom and fop
pdlnhrd at yahoo.com
pdlnhrd at yahoo.com
Tue Nov 5 06:06:48 PST 2002
Laurent,
Thank you for your help. (and everyone else you has responded in this
thread) I think your last bit of info finally filled all the holes
that I was struggling with.
I finally got Malachi's suggestion to work yesterday by doing this:
pdfDriver.setInputSource( (new JDOMSource(doc)).getInputSource() );
which worked well, but I felt it was still too many steps for what i
was trying to do.
here is my final code to benefit those who might need it in the
future:
Document doc = new Document(root);
ByteArrayOutputStream output = new ByteArrayOutputStream();
org.apache.fop.apps.Driver pdfDriver = new
org.apache.fop.apps.Driver();
pdfDriver.setOutputStream(output);
pdfDriver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
Transformer transformer =
TransformerFactory.newInstance().newTransformer(new
StreamSource("/usr/local/home/pd/user.xsl"));
transformer.transform(new JDOMSource(doc), new
SAXResult(pdfDriver.getContentHandler()));
byte[] content = output.toByteArray();
response.setContentType("application/pdf");
response.setContentLength(content.length);
response.getOutputStream().write(content);
response.getOutputStream().flush();
thanks again for all the help everyone.
pdlnhrd
//off to learn how to Template to cache my stylesheets
__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
More information about the jdom-interest
mailing list