The FOP (Formatting Objects Processor) package contains a print formatter driven by XSL formatting objects (XSL-FO). It is a Java application that reads a formatting object tree and renders the resulting pages to a specified output. Output formats currently supported include PDF, PCL, PostScript, SVG, XML (area tree representation), print, AWT, MIF and ASCII text. The primary output target is PDF.
Download (HTTP): http://www.apache.org/dist/xml/fop/fop-0.20.5-src.tar.gz
Download (FTP): ftp://apache.mirrors.pair.com/xml/fop/source/fop-0.20.5-src.tar.gz
Download MD5 sum: 1a31eb1357e5d4b8d32d4cb3edae2da2
Download size: 7.8 MB
Estimated disk space required: 45.3 MB
Estimated build time: 0.25 SBU
Required package
Java Advanced Imaging (JAI) API components: http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22& PartDetailId=jai-1_1_2_01-oth-JPR&SiteId=JSC&TransactionId=noreg
Download MD5 sum: f2be3619a8d002eff3874355e96327eb
Download size: 2.6 MB
Choose the “Linux JDK Install” file after accepting the license agreement.
libxslt-1.1.14, JIMI SDK, Batik and Forrest (only used to rebuild the documentation)
Ensure $JAVA_HOME is set correctly before beginning the build.
Some versions of tar will display a message similar to “tar: A lone zero block at 33476” when unpacking the source tarball. You may safely ignore this message.
Install the JAI components by running the following commands as the root user while in the root of the FOP source tree:
chmod 755 ../jai-1_1_2_01-lib-linux-i586-jdk.bin && FOP_BUILD_DIR=$(pwd) && cd $JAVA_HOME && yes | $FOP_BUILD_DIR/../jai-1_1_2_01-lib-linux-i586-jdk.bin && cd $FOP_BUILD_DIR
Install FOP by running the following commands:
patch -Np1 -i ../fop_0.20.5-jdk_1.5.0-1.patch && ./build.sh && sed -i -e "s/build/lib/" fop.sh
Now, as the root user:
install -v -d -m755 \ /opt/fop-0.20.5/{bin,lib,docs/{general,lib,site}} && install -v -m755 fop.sh /opt/fop-0.20.5/bin && install -v -m644 build/fop.jar lib/avalon-framework-cvs-20020806.jar \ /opt/fop-0.20.5/lib && install -v -m644 docs/* /opt/fop-0.20.5/docs && install -v -m644 CHANGES LICENSE README ReleaseNotes.html STATUS \ /opt/fop-0.20.5/docs/general && install -v -m644 lib/{avalon.LICENSE.txt,readme} \ /opt/fop-0.20.5/docs/lib && cp -v -R build/site/* /opt/fop-0.20.5/docs/site && ln -svf fop-0.20.5 /opt/fop
You'll need to install one additional Java class library to process SVG objects. This library is part of the Batik package, but is also included with the FOP package. If you have Batik installed, ensure the batik.jar library is included in your $CLASSPATH environment variable. Alternatively, create a symbolic link from /opt/fop-0.20.5/lib/batik.jar pointing to the full path of the installed batik.jar file so that the fop.sh script will automatically pick it up.
If you don't have the Batik package installed, run the following commands as the root user:
install -v -m644 lib/batik.jar /opt/fop-0.20.5/lib && install -v -m644 lib/batik.LICENSE.txt \ /opt/fop-0.20.5/docs/lib
The components of FOP required to process FO files created by an XSL transformation engine (also known as an XSLT processor) is now complete. An XSL transformation engine (xsltproc) is included with the libxslt-1.1.14 package in BLFS. The FOP package includes components of Xalan-Java to accomplish XSL transformations. If you have the Xalan-Java package installed, skip to the next section.
If you wish to install the Xalan-Java components provided by the FOP package, run the following commands as the root user:
sed -i -e "s/build/lib/" xalan.sh && install -v -m755 xalan.sh /opt/fop-0.20.5/bin && install -v -m644 lib/xml-apis.jar \ lib/xercesImpl-2.2.1.jar \ lib/xalan-2.4.1.jar \ /opt/fop-0.20.5/lib && install -v -m644 lib/{xml-apis,xerces,xalan}.LICENSE.txt \ lib/xml-apis.README.txt \ /opt/fop-0.20.5/docs/lib
yes | $FOP_BUILD_DIR/../jai-...-jdk.bin: This command installs the JAI components into the JDK file structure. The yes command is piped through so that you don't have to scroll through four pages of the license agreement and automatically responds “yes” to the agreement. $FOP_BUILD_DIR is used as a reference point to the source executable and as a method to return back to the FOP source tree.
sed -i -e "s/build/lib/" ...: These commands modify the installed shell scripts so that the location of the installed fop.jar file is correctly identified.
install -v ...; cp -v ...: There is no installation script provided by the FOP package. These commands install the package.
ln -svf fop-0.20.5 /opt/fop: This creates a convenience symlink so that $FOP_HOME doesn't have to be changed each time there's a package version change.
Using FOP to process some large FO's (including the FO derived from the BLFS XML sources), can lead to memory errors. Unless you add a parameter to the java command used in the fop.sh script you may receive messages similar to the one shown below:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
To avoid errors like this, you need to pass an extra parameter to the java command used in the fop.sh script. This can be accomplished by creating a ~/.foprc (which is sourced by the fop.sh script) and adding the parameter to the FOP_OPTS environment variable.
The fop.sh script looks for a FOP_HOME environment variable to locate the FOP class libraries. You can create this variable using the ~/.foprc file as well. Create a ~/.foprc file using the following commands:
cat > ~/.foprc << "EOF" FOP_OPTS="-Xmx[RAM_Installed]m" FOP_HOME="/opt/fop" EOF
Replace [RAM_Installed] with a number representing the amount of RAM installed in your computer. An example would be FOP_OPTS="-Xmx768m". For more information about memory issues running FOP, see http://xml.apache.org/fop/running.html#memory.
To include the fop.sh script in your path, update your personal or system-wide profile with the following:
PATH=$PATH:/opt/fop/bin
Last updated on 2005-08-01 13:29:19 -0600