For me this work on 0.20.5rc
 
 
        File xslt = new File ("some.xsl");
        File pdf = new File("some.pdf");
        String xml = createXML();
        //Construct driver
        org.apache.fop.apps.Driver driver = new org.apache.fop.apps.Driver();
        //Setup logger
        Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG);
        driver.setLogger(logger);
        MessageHandler.setScreenLogger(logger);
        //Setup Renderer (output format)
        driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
        //Setup output
        OutputStream out = new java.io.FileOutputStream(pdf);
        driver.setOutputStream(out);
        //Setup XSLT
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(new StreamSource(xslt));
        //Setup input for XSLT transformation
        Source src = "" StreamSource(new java.io.StringReader(xml));
        //Resulting SAX events (the generated FO) must be piped through to FOP
        Result res = new SAXResult(driver.getContentHandler());
        //Start XSLT transformation and FOP processing
        transformer.transform(src, res);
        out.close();
 
hope this help
 
 
I'd like to generate xml string from a different source ( using directly some class instead of reading from a file and creating a String variable )...  my xml source doen't inclusde any reference to external source... so
I tryed to open result using a StringReader... but a lot of exception come up when I compiled my class..  perhaps, systemID is always required...
 
Could someone help me?
 
thanks in advance

Reply via email to