Hi Gustavo,

I've tried several ways to pass the data (in memory)
from source (basically SVG in my case) through FOP.
Here is one example:

         Node svgTree = ...        // DOM source
         Reader style = ...        // the XSL
         OutputStream stream = ... // destination

         // Do the XSLT.
         Source source = new DOMSource(svgTree);
         Result result = new DOMResult();
         try {
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer =
               factory.newTransformer(new StreamSource(style));
            transformer.transform(source, result);
         } catch( TransformerFactoryConfigurationError tfe ) {
            tfe.printStackTrace();
            return;
         } catch( TransformerConfigurationException tce ) {
            tce.printStackTrace();
            return;
         } catch( TransformerException te ) {
            te.printStackTrace();
            return;
         }
         // And here we've got the FO DOM.
         Document foDocument = (Document)((DOMResult)result).getNode();

         // Create the PDF.
         Driver driver = new Driver();
         driver.setRenderer(Driver.RENDER_PDF);
 
driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
         driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
 
driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
 
driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
         try {
            driver.setOutputStream(stream);
            driver.buildFOTree(foDocument);
            driver.format();
            driver.render();   
         } catch( FOPException fe ) {
            fe.printStackTrace();
         } catch( IOException ioe ) {
            ioe.printStackTrace();
         } finally {
            try { stream.close(); }
            catch( IOException e ) {}
         }

I hope this will help you - I'm looking forward to the beer.
(I've never been to CH. Do they know about beer there?)

Jens Thieler

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to