Contents
/opt/fop/{build,lib}
; JAI components include
libmlib_jai.so, jai_codec.jar, jai_core.jar, and
mlibwrapper_jai.jar
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.
This package is known to build and work properly using an LFS-7.9 platform.
Download (HTTP): https://archive.apache.org/dist/xmlgraphics/fop/source/fop-2.1-src.tar.gz
Download MD5 sum: 13b5b497dfb0ba8a01093dfc1a89d106
Download size: 23 MB
Estimated disk space required: 342 MB
Estimated build time: 0.3 SBU
Recommended packages
Java Advanced Imaging (JAI) API components (architecture
dependent):
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-linux-i586.tar.gz
a2cbc155ef3899bcde9c74a8035764b3
3.4 MB
or
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-linux-amd64.tar.gz
4a906db35612f668aeef2c0606d7075b
3.4 MB
JUnit-4.11 (to run tests), X Window System (to run tests), JIMI SDK, XMLUnit, JAI Image I/O Tools, JEuclid, PMD (requires Jaxen), and Forrest (Forrest used only to build the documentation)
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/fop
Ensure $JAVA_HOME
is set correctly
before beginning the build. To build the JIMI SDK and/or XMLUnit extension classes, ensure the
corresponding .jar
files can be found
via the CLASSPATH
environment variable.
Install the JAI API components. As the root
user:
case `uname -m` in i?86) tar -xf ../jai-1_1_3-lib-linux-i586.tar.gz cp -v jai-1_1_3/lib/{jai*,mlibwrapper_jai.jar} $JAVA_HOME/jre/lib/ext/ cp -v jai-1_1_3/lib/libmlib_jai.so $JAVA_HOME/jre/lib/i386/ ;; x86_64) tar -xf ../jai-1_1_3-lib-linux-amd64.tar.gz cp -v jai-1_1_3/lib/{jai*,mlibwrapper_jai.jar} $JAVA_HOME/jre/lib/ext/ cp -v jai-1_1_3/lib/libmlib_jai.so $JAVA_HOME/jre/lib/amd64/ ;; esac
The javadoc command coming with OpenJDK 8 has become much stricter than before regarding the conformance of the Javadoc comments in source code to HTML. The FOP documentation does not meet those standard, so the conformance checks have to be disabled. This can be done with the following command:
sed -i '\@</javad@i<arg value="-Xdoclint:none"/>' build.xml
Then, compile fop by running the following commands:
patch -Np1 -i ../fop-2.1-listNPE-1.patch && ant compile && ant jar-main && ant javadocs && mv build/javadocs .
To test the application, run ant junit-all. The hyphenation tests will fail. To see a list of other test targets, use ant -p. You must run the tests from an X-window using a GL-aware Xorg server or some of the JUnit tests will hang.
Now, as the root
user:
install -v -d -m755 /opt/fop-2.1 && cp -v KEYS LICENSE NOTICE README /opt/fop-2.1 && cp -va build conf examples fop* javadocs lib /opt/fop-2.1 && ln -v -sf fop-2.1 /opt/fop
ant target
: This reads the file
build.xml
and builds the target
files.
ln -v -sf fop-2.1
/opt/fop: This is optional and 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 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
script. This can be accomplished by creating a ~/.foprc
(which is sourced by the fop script) and adding the
parameter to the FOP_OPTS
environment
variable.
The fop 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
(in megabytes). An example would be FOP_OPTS="-Xmx768m"
.
To include the fop script in your path, update your personal or system-wide profile with the following:
PATH=$PATH:/opt/fop
Running fop can
be somewhat verbose. The default logging level can be changed
from INFO to any of FINEST, FINER, FINE, CONFIG, INFO, WARNING,
SEVERE, ALL, or OFF. To do this, edit $JAVA_HOME/jre/lib/logging.properties
and
change the entries for .leval
and
java.util.logging.ConsoleHandler.level
to the
desired value.
/opt/fop/{build,lib}
; JAI components include
libmlib_jai.so, jai_codec.jar, jai_core.jar, and
mlibwrapper_jai.jar
Last updated on 2016-02-28 12:51:39 -0800