Publishing Books Using XML Technologies
Dr. Herong Yang, Version 4.01

Installing Apache FOP - XSL-FO Processor

This section provides installation information of Apache FOP (Formatting Objects Processor).

After a quick research on the Internet, FOP (Formatting Objects Processor) seems to be the most popular XSL-FO processor. So here is how to download and install FOP.

1. Go to http://xml.apache.org/dist/fop/ and download fop-0.20.5rc2-bin.tar.gz

2. Open fop-0.20.5rc2-bin.tar.gz with WinZIP and extract everything to directory, like \local\fop-0.20.5rc2.

3. Create a batch file, fop.bat, with following command:

java -cp \local\fop-0.20.5rc2\build\fop.jar;
  \local\fop-0.20.5rc2\lib\xercesImpl-2.2.1.jar;
  \local\fop-0.20.5rc2\lib\xalan-2.4.1.jar;
  \local\fop-0.20.5rc2\lib\avalon-framework-cvs-20020806.jar;
  \local\fop-0.20.5rc2\lib\batik.jar org.apache.fop.apps.Fop
  %1 %2 %3 %4 %5 %6

Make sure that you enter everything into one line, and leave no space between the .jar file names. Because of the screen limitation, I have to split the command into multiple lines.

Now run the batch file in a command window. If you are getting the following:

fop
USAGE
Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif
   |-pcl|-ps|-txt|-at|-print] <outfile>
 [OPTIONS]
  -d          debug mode
  -x          dump configuration settings
  -q          quiet mode
  -c cfg.xml  use additional configuration file cfg.xml
  -l lang     the language to use for user information
  -s          for area tree XML, down to block areas only
...

the installation is ok.

You may have trouble to run the batch file, fop.bat, if you don't have Java installed properly on your system.

According to the documentation, FOP can be used to:

  • Format an XSL-FO file to a .txt, .pdf, or .ps file.
  • Transform and format an XML file and an XSLT file to a .txt, .pdf, or .ps file.

".pdf" is called Portable Document Format (PDF), and ".ps" is called PostScript (PS).

Table of Contents

 About This Book

 Ideas on Publishing Books using XML

 Overview of hyPub - A Simple XML Publishing Tool

 Writing Book Contents in XHTML Source Files

 Transforming Book Source Files with XSL Technology

 Designing Web Page Layouts with Tables

 Controlling Web Page Appearance with CSS

 Sharing HTML Codes with JavaScript Files

 Generating Web Pages with hyPub

Formatting Printable Documents with XSL-FO

 What Is XSL-FO (XSL Formatting Objects)

 Example of XSL-FO Document - hello.fo

Installing Apache FOP - XSL-FO Processor

 Formatting XSL-FO Files to Text Files Using FOP

 Formatting XSL-FO Files to PDF Files Using FOP

 Formatting XML Files to PDF Files with XSLT

 Tranforming XML Files with XSLT Stylesheets

 Generating PDF Documents with hyPub

 Areas of Future Improvements

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2007
Installing Apache FOP - XSL-FO Processor