http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Download
Running FOP
Features
Limitations
Bugs
Examples

Compiling
Embedding
Getting involved
Architecture

FAQs
Specifications
License

 

Instantiate org.apache.fop.apps.Driver. Once this class is instantiated, methods are called to set the Renderer to use, the (possibly multiple) ElementMapping(s) to use and the PrintWriter to use to output the results of the rendering (where applicable). In the case of the Renderer and ElementMapping(s), the Driver may be supplied either with the object itself, or the name of the class, in which case Driver will instantiate the class itself. The advantage of the latter is it enables runtime determination of Renderer and ElementMapping(s).

Once the Driver is set up, the buildFOTree method is called. Depending on whether DOM or SAX is being used, the invocation of the method is either buildFOTree(Document) or buildFOTree(Parser, InputSource) respectively.

A third possibility may be used to build the FO Tree, namely calling getDocumentHandler() and firing the SAX events yourself.

Once the FO Tree is built, the format() and render() methods may be called in that order.

Here is an example use of Driver from CommandLine.java:

Driver driver = new Driver();

driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", version);

driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");

driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");

driver.setWriter(new PrintWriter(new FileWriter(args[1])));

driver.buildFOTree(parser, fileInputSource(args[0]));

driver.format();

driver.render();



Copyright © 1999 The Apache Software Foundation. All Rights Reserved.