fop-2.2

fop の概要

FOP (Formatting Objects Processor) は XSL フォーマットオブジェクト (XSL formatting objects; XSL-FO) に基づいた、印刷フォーマッターを提供します。 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.

本パッケージは LFS-8.0 において正しくビルドでき動作することが確認されています。

パッケージ情報

追加のダウンロード

推奨

fop の依存パッケージ

必須

apache-ant-1.10.1

任意

JUnit-4.11 (テスト実行のため), X ウィンドウシステム (テスト実行のため), Maven, JAI Image I/O Tools, JEuclid

ユーザー情報: http://wiki.linuxfromscratch.org/blfs/wiki/fop

fop のインストール

ビルド前には環境変数 $JAVA_HOME が適切に設定されていることを確認してください。 また JIMI SDKXMLUnit といった拡張クラスをビルドする場合は、環境変数 CLASSPATH にて対応する .jar が設定されていることを確認してください。

OFFO ハイフネーションパターンのインストール

Copy the XML hyphenation patterns into the fop source tree by running the following commands:

unzip ../offo-hyphenation.zip &&
cp offo-hyphenation/hyph/* fop/hyph &&
rm -rf offo-hyphenation

Java Advanced Imaging (JAI) API コンポーネント のインストール

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

fop コンポーネントのインストール

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"/>\
<arg value="--allow-script-in-comments"/>' fop/build.xml

The stack size set in build.xml for building the hyphenation patterns is not enough. Change it by running:

sed -e '/hyph\.stack/s/512k/1M/' \
    -i fop/build.xml

以下のコマンドを実行して fop をビルドします。

cd fop                    &&
export LC_ALL=en_US.UTF-8 &&

ant compile               &&
ant jar-main              &&
ant jar-hyphenation       &&
ant javadocs              &&
mv build/javadocs .

To test the application, first modify build.xml so that tests do not stop when an error is encountered:

sed -e '/haltonfailure/s/yes/off/' \
    -i build.xml

Then, run ant junit. The hyphenation tests will fail if OFFO hyphenation has not been compiled. 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.

root ユーザーになって以下を実行します。

install -v -d -m755 -o root -g root          /opt/fop-2.2 &&
cp -v  ../{KEYS,LICENSE,NOTICE,README}       /opt/fop-2.2 &&
cp -vR build conf examples fop* javadocs lib /opt/fop-2.2 &&
chmod a+x /opt/fop-2.2/fop                                &&

ln -v -sfn fop-2.2 /opt/fop

コマンド説明

sed -i ... build.xml: This adds two switches to the javadoc command, preventing some errors to occur when building the documentation.

export LC_ALL=en_US.UTF-8: the compiler fails if using an ASCII locale.

ant target: This reads the file build.xml and builds the target: compile compiles the java sources, jar-main generates jar archives, jar-hyphenation generates the hyphenation patterns for FOP, and javadocs builds the documentation.

ln -v -sf fop-2.2 /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.

fop の設定

設定ファイル

~/.foprc

設定情報

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 .level and java.util.logging.ConsoleHandler.level to the desired value.

パッケージ構成

インストールプログラム: fop
インストールライブラリ: fop.jar and numerous support library classes located in /opt/fop/{build,lib}; JAI components include libmlib_jai.so, jai_codec.jar, jai_core.jar, mlibwrapper_jai.jar
インストールディレクトリ: /opt/fop-2.2

概略説明

fop

is a wrapper script to the java command which sets up the fop environment and passes the required parameters.

fop.jar

fop のすべての Java クラスを提供します。

最終更新日: 2017-08-16 03:49:48 +0900