| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Primary class that drives overall FOP process.
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();
Constructor Summary | |
XTDriver() create a new Driver |
Method Summary | |
void | addElementMapping(ElementMapping mapping) add the given element mapping. |
void | addElementMapping(String mappingClassName) add the element mapping with the given class name |
void | addPropertyList(String listClassName) add the element mapping with the given class name |
void | buildFOTree(Parser parser, InputSource source) build the formatting object tree using the given SAX Parser and SAX InputSource |
void | buildFOTree(Document document) build the formatting object tree using the given DOM Document |
void | format() format the formatting object tree into an area tree |
DocumentHandler | getDocumentHandler() return the tree builder (a SAX DocumentHandler). |
void | render() render the area tree to the output form |
void | setOutputStream(OutputStream stream) set the OutputStream to use to output the result of the Renderer (if applicable) |
void | setRenderer(Renderer renderer) set the Renderer to use |
void | setRenderer(String rendererClassName, String producer) set the class name of the Renderer to use as well as the producer string for those renderers that can make use of it |
void | setWriter(PrintWriter writer) set the PrintWriter to use to output the result of the Renderer (if applicable) |
Constructor Detail |
public XTDriver()
Method Detail |
public void addElementMapping(ElementMapping mapping)
public void addElementMapping(String mappingClassName)
public void addPropertyList(String listClassName)
public void buildFOTree(Parser parser, InputSource source)
throws FOPException
public void buildFOTree(Document document)
throws FOPException
public void format()
throws FOPException
public DocumentHandler getDocumentHandler()
public void render()
throws java.io.IOException,
FOPException
public void setOutputStream(OutputStream stream)
public void setRenderer(Renderer renderer)
public void setRenderer(String rendererClassName, String producer)
public void setWriter(PrintWriter writer)
Association Links |
to Class org.apache.fop.layout.AreaTree
to Class org.apache.fop.render.Renderer
to Class java.io.PrintWriter
to Class java.io.OutputStream
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |