Running FOP

There are two ways of running FOP from the command line.

Method One

One is to first use an XSLT engine to produce the formatting object tree as an XML document and then running the class com.jtauber.fop.apps.CommandLine with the formatting object file name and PDF filename as arguments. You will need to include FOP, SAX and your SAX Parser in your classpath and so you might invoke

java -cp fop_x_xx_x.jar;sax.jar;xp.jar com.jtauber.fop.apps.CommandLine formatting-tree-file pdf-file

If your SAX Parser is other than XP, you will need to set the property org.xml.sax.parser to the SAX Parser class to use.

Method Two

Rather than performing transformation with an XSLT before invoking FOP, it is possible, if you use XT as your XSLT engine, to just call FOP and have it call XT for you. To do this, run the class com.jtauber.fop.apps.XTCommandLine with the source XML file name, XSL file name and PDF file name as arguments. You will need to include FOP, SAX, your SAX Parser and XT in your classpath and so you might invoke

java -cp fop_x_xx_x.jar;sax.jar;xp.jar;xt.jar com.jtauber.fop.apps.XTCommandLine xml-file xsl-file pdf-file

Again, if your SAX Parser is other than XP, you will need to set the property org.xml.sax.parser to the SAX Parser class to use.

James Tauber / jtauber@jtauber.com
Last updated: 1999-09-16