source: pst/ps/fop.xml

trunk
Last change on this file was 6b33b5b, checked in by Bruce Dubbs <bdubbs@…>, 2 months ago

Finish tagging for chapters 46-50.

  • Property mode set to 100644
File size: 15.0 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY fop-download-http "https://archive.apache.org/dist/xmlgraphics/fop/source/fop-&fop-version;-src.tar.gz">
8 <!ENTITY fop-download-ftp " ">
9 <!ENTITY fop-md5sum "f7537ca7f2e16971fa99c8bb0dad62c7">
10 <!ENTITY fop-size "20 MB">
11 <!ENTITY fop-buildsize "333 MB (including files downloaded to the user directory)">
12 <!ENTITY fop-time "0.9 SBU">
13<!--
14 <!ENTITY pdfbox-version "2.0.27">
15 <!ENTITY pdfbox-download "https://archive.apache.org/dist/pdfbox/&pdfbox-version;/pdfbox-&pdfbox-version;.jar">
16 <!ENTITY pdfbox-md5sum "ddd46402b1692eed9e5c73b4a94c45d8">
17 <!ENTITY pdfbox-size "2.7 MB">
18
19 <!ENTITY fontbox-download "https://archive.apache.org/dist/pdfbox/&pdfbox-version;/fontbox-&pdfbox-version;.jar">
20 <!ENTITY fontbox-md5sum "587744efe2a82d3584c2f3969fa4dca0">
21 <!ENTITY fontbox-size "1.5 MB">
22-->
23 <!ENTITY maven-major "3">
24 <!ENTITY maven-version "3.9.4">
25 <!ENTITY maven-download "https://archive.apache.org/dist/maven/maven-&maven-major;/&maven-version;/binaries/apache-maven-&maven-version;-bin.tar.gz">
26 <!ENTITY maven-md5sum "0698a533397eda60cbebcc0fb68ae842">
27 <!ENTITY maven-size "9.0 MB (additionally, about 90 MB are downloaded to the building user's directory)">
28
29 <!ENTITY offo-download "&sourceforge-dl;/offo/2.2/offo-hyphenation.zip">
30 <!ENTITY offo-md5sum "bf9c09bf05108ef9661b8f08d91c2336">
31 <!ENTITY offo-size "862 KB">
32]>
33
34<sect1 id="fop" xreflabel="fop-&fop-version;">
35 <?dbhtml filename="fop.html"?>
36
37
38 <title>fop-&fop-version;</title>
39
40 <indexterm zone="fop">
41 <primary sortas="a-fop">fop</primary>
42 </indexterm>
43
44 <sect2 role="package">
45 <title>Introduction to fop</title>
46
47 <para>
48 The <application>FOP</application> (Formatting Objects Processor)
49 package contains a print formatter driven by XSL formatting objects
50 (XSL-FO). It is a <application>Java</application> application that reads
51 a formatting object tree and renders the resulting pages to a specified
52 output. Output formats currently supported include PDF, PCL, PostScript,
53 SVG, XML (area tree representation), print, AWT, MIF and ASCII text. The
54 primary output target is PDF.
55 </para>
56
57 &lfs121_checked;
58
59 <bridgehead renderas="sect3">Package Information</bridgehead>
60 <itemizedlist spacing="compact">
61 <listitem>
62 <para>
63 Download (HTTP): <ulink url="&fop-download-http;"/>
64 </para>
65 </listitem>
66 <listitem>
67 <para>
68 Download (FTP): <ulink url="&fop-download-ftp;"/>
69 </para>
70 </listitem>
71 <listitem>
72 <para>
73 Download MD5 sum: &fop-md5sum;
74 </para>
75 </listitem>
76 <listitem>
77 <para>
78 Download size: &fop-size;
79 </para>
80 </listitem>
81 <listitem>
82 <para>
83 Estimated disk space required: &fop-buildsize;
84 </para>
85 </listitem>
86 <listitem>
87 <para>
88 Estimated build time: &fop-time;
89 </para>
90 </listitem>
91 </itemizedlist>
92
93 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
94 <itemizedlist spacing="compact">
95 <title>Required Additional Downloads:</title>
96<!--
97 <listitem>
98 <para>
99 PDFBox:
100 <simplelist>
101 <member><ulink url="&pdfbox-download;"/></member>
102 <member>&pdfbox-md5sum;</member>
103 <member>&pdfbox-size;</member>
104 </simplelist>
105 </para>
106 </listitem>
107 <listitem>
108 <para>
109 PDFBox Fonts:
110 <simplelist>
111 <member><ulink url="&fontbox-download;"/></member>
112 <member>&fontbox-md5sum;</member>
113 <member>&fontbox-size;</member>
114 </simplelist>
115 </para>
116 </listitem>
117-->
118 <listitem>
119 <para>
120 Maven build system:
121 <simplelist>
122 <member><ulink url="&maven-download;"/></member>
123 <member>&maven-md5sum;</member>
124 <member>&maven-size;</member>
125 </simplelist>
126 </para>
127 </listitem>
128 </itemizedlist>
129
130 <itemizedlist spacing="compact">
131 <title>Recommended packages</title>
132 <listitem>
133 <para>
134 Objects for Formatting Objects (OFFO) hyphenation patterns:
135 <simplelist>
136 <member><ulink url="&offo-download;"/></member>
137 <member>&offo-md5sum;</member>
138 <member>&offo-size;</member>
139 </simplelist>
140 </para>
141 </listitem>
142 </itemizedlist>
143
144 <bridgehead renderas="sect3">fop Dependencies</bridgehead>
145
146 <bridgehead renderas="sect4">Required</bridgehead>
147 <para role="required">
148 <xref linkend="apache-ant"/>
149 </para>
150
151 <bridgehead renderas="sect4">Optional</bridgehead>
152 <para role="optional">
153 <xref linkend="x-window-system"/> (to run tests),
154 <ulink url="https://jai-tools.blogspot.com/">JAI Image I/O Tools</ulink>, and
155 <ulink url="https://jeuclid.sourceforge.net/">JEuclid</ulink>
156<!-- [pierre 2017-04-29] Note to devs: there are a lot of bundled dependencies.
157 Some were listed here, but not all. I am not sure it is possible to
158 use system ones. So, I have removed them, and kept only those which
159 are not bundled. -->
160 </para>
161
162
163 </sect2>
164
165 <sect2 role="installation">
166 <title>Installation of fop</title>
167
168 <para>
169 Ensure <envar>$JAVA_HOME</envar> is set correctly before beginning
170 the build. To build the <application>JIMI SDK</application> and/or
171 <application>XMLUnit</application> extension classes, ensure the
172 corresponding <filename class='extension'>.jar</filename> files can be
173 found via the <envar>CLASSPATH</envar> environment variable.
174 </para>
175
176 <sect3>
177 <title>Installing OFFO Hyphenation Patterns</title>
178
179 <para>
180 Copy the XML hyphenation patterns into the fop source tree by running
181 the following commands:
182 </para>
183
184<screen><userinput>unzip ../offo-hyphenation.zip &amp;&amp;
185cp offo-hyphenation/hyph/* fop/hyph &amp;&amp;
186rm -rf offo-hyphenation</userinput></screen>
187
188 </sect3>
189
190 <sect3>
191 <title>Installing a temporary Maven binary</title>
192
193 <para>
194 Starting with fop-2.5, the Maven build system is required. We use
195 the binary provided by apache, that we install in a temporary location:
196 </para>
197
198<screen><userinput>tar -xf ../apache-maven-&maven-version;-bin.tar.gz -C /tmp</userinput></screen>
199
200 </sect3>
201
202 <sect3>
203 <title>Installing fop Components</title>
204
205 <para>
206 The <command>javadoc</command> command that ships with OpenJDK 10 and
207 later has
208 become much stricter than previous versions regarding conformance of
209 the Javadoc comments in source code to HTML. The FOP documentation does
210 not meet those standards, so the conformance checks have to be
211 disabled. This can be done with the following command:
212 </para>
213
214<screen><userinput>sed -i '\@&lt;/javad@i\
215&lt;arg value="-Xdoclint:none"/&gt;\
216&lt;arg value="--allow-script-in-comments"/&gt;\
217&lt;arg value="--ignore-source-errors"/&gt;' \
218 fop/build.xml</userinput></screen>
219
220<!--
221 <para>
222 The <filename>build.xml</filename> file calls for an old version of
223 <application>PDFBox</application> components that are no longer
224 available. Copy the updated PDFBox components into the source tree:
225 </para>
226
227<screen><userinput>cp ../{pdf,font}box-&pdfbox-version;.jar fop/lib</userinput></screen>
228-->
229 <para>
230 Compile <application>fop</application> by running the following
231 commands:
232 </para>
233
234<screen><userinput>cd fop &amp;&amp;
235
236LC_ALL=en_US.UTF-8 \
237PATH=$PATH:/tmp/apache-maven-&maven-version;/bin \
238ant all javadocs &amp;&amp;
239
240mv build/javadocs .</userinput></screen>
241
242 <para>
243 This package comes with a test suite, but the java infrastructure
244 installed in this book does not allow running it.
245 </para>
246
247 <para>
248 Now, install <application>Fop</application> as the
249 <systemitem class="username">root</systemitem> user:
250 </para>
251
252<screen role="root"><userinput>install -v -d -m755 -o root -g root /opt/fop-&fop-version; &amp;&amp;
253cp -vR build conf examples fop* javadocs lib /opt/fop-&fop-version; &amp;&amp;
254chmod a+x /opt/fop-&fop-version;/fop &amp;&amp;
255ln -v -sfn fop-&fop-version; /opt/fop</userinput></screen>
256
257 <para>
258 The last thing to do is to clean what we have done:
259 </para>
260
261<screen><userinput>rm -rf /tmp/apache-maven-&maven-version;</userinput></screen>
262
263 </sect3>
264
265 </sect2>
266
267 <sect2 role="commands">
268 <title>Command Explanations</title>
269
270 <para>
271 <command>sed -i ... build.xml</command>: This adds three switches to the
272 <command>javadoc</command> command, preventing some errors from occurring
273 when building the documentation.
274 </para>
275
276 <para>
277 <command>export LC_ALL=en_US.UTF-8</command>: the compiler fails if using
278 an ASCII locale.
279 </para>
280
281 <para>
282 <command>ant <option>target</option></command>: This reads the file
283 <filename>build.xml</filename> and builds the target: <option>compile
284 </option> compiles the java sources, <option>jar-main</option> generates
285 jar archives, <option>jar-hyphenation</option> generates the hyphenation
286 patterns for FOP, <option>junit</option> runs the
287 <application>junit</application> tests, and <option>javadocs</option>
288 builds the documentation. The <option>all</option> target runs all of the
289 above.
290 </para>
291
292 <para>
293 <command>ln -v -sf fop-&fop-version; /opt/fop</command>: This is
294 optional and creates a convenience symlink so that
295 <envar>$FOP_HOME</envar> doesn't have to be changed each time there's a
296 package version change.
297 </para>
298
299 </sect2>
300
301 <sect2 role="configuration">
302 <title>Configuring fop</title>
303
304 <sect3 id="fop-config">
305 <title>Config Files</title>
306
307 <para>
308 <filename>~/.foprc</filename>
309 </para>
310
311 <indexterm zone="fop fop-config">
312 <primary sortas="e-AA.foprc">~/.foprc</primary>
313 </indexterm>
314
315 </sect3>
316
317 <sect3>
318 <title>Configuration Information</title>
319
320 <para>
321 Using <application>fop</application> to process some large FO's
322 (including the FO derived from the BLFS XML sources), can lead to
323 memory errors. Unless you add a parameter to the
324 <command>java</command> command used in the <command>fop</command>
325 script you may receive messages similar to the one shown below:
326 </para>
327
328 <para>
329 <computeroutput>
330 Exception in thread "main" java.lang.OutOfMemoryError: Java heap
331 space
332 </computeroutput>
333 </para>
334
335 <para>
336 To avoid errors like this, you need to pass an extra parameter to
337 the <command>java</command> command used in the <command>fop</command>
338 script. This can be accomplished by creating a
339 <filename>~/.foprc</filename> (which is sourced by the
340 <command>fop</command> script) and adding the parameter to the
341 <envar>FOP_OPTS</envar> environment variable.
342 </para>
343
344 <para>
345 The <command>fop</command> script looks for a
346 <envar>FOP_HOME</envar> environment variable to locate the
347 <application>fop</application> class libraries. You can create this
348 variable using the <filename>~/.foprc</filename> file as well. Create
349 a <filename>~/.foprc</filename> file using the following commands:
350 </para>
351
352<screen><userinput>cat &gt; ~/.foprc &lt;&lt; "EOF"
353<literal>FOP_OPTS="-Xmx<replaceable>&lt;RAM_Installed&gt;</replaceable>m"
354FOP_HOME="/opt/fop"</literal>
355EOF</userinput></screen>
356
357 <para>
358 Replace <replaceable>&lt;RAM_Installed&gt;</replaceable> with a
359 number representing the amount of RAM installed in your computer (in
360 megabytes). An example would be
361 <userinput>FOP_OPTS="-Xmx768m"</userinput>.
362 <!-- the URL is broken
363 For more information about
364 memory issues running <application>fop</application>, see
365 <ulink url="http://xml.apache.org/fop/running.html#memory"/>.
366 -->
367 </para>
368
369 <para>
370 To include the <command>fop</command> script in your path,
371 update the system-wide profile with the following command as the
372 <systemitem class="username">root</systemitem> user:
373 </para>
374
375<screen role="root"><userinput>cat &gt; /etc/profile.d/fop.sh &lt;&lt; "EOF"
376<literal># Begin /etc/profile.d/fop.sh
377
378pathappend /opt/fop
379
380# End /etc/profile.d/fop.sh</literal>
381EOF</userinput></screen>
382
383 <note>
384 <para>
385 Running <command>fop</command> can be somewhat verbose.
386 The default logging level can be changed from INFO to any of
387 FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, ALL, or OFF.
388 To do this, edit
389 <filename>$JAVA_HOME/jre/lib/logging.properties</filename> and change
390 the entries for <option>.level</option> and
391 <option>java.util.logging.ConsoleHandler.level</option> to
392 the desired value.
393 </para>
394 </note>
395
396 </sect3>
397
398 </sect2>
399
400 <sect2 role="content">
401 <title>Contents</title>
402
403 <segmentedlist>
404 <segtitle>Installed Programs</segtitle>
405 <segtitle>Installed Libraries</segtitle>
406 <segtitle>Installed Directory</segtitle>
407
408 <seglistitem>
409 <seg>fop</seg>
410 <seg>fop.jar and numerous support library classes located in
411 <filename class="directory">/opt/fop/{build,lib}</filename>; JAI
412 components include libmlib_jai.so, jai_codec.jar, jai_core.jar, and
413 mlibwrapper_jai.jar</seg>
414 <seg>/opt/fop-&fop-version;</seg>
415 </seglistitem>
416 </segmentedlist>
417
418 <variablelist>
419 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
420 <?dbfo list-presentation="list"?>
421 <?dbhtml list-presentation="table"?>
422
423 <varlistentry id="fop-prog">
424 <term><command>fop</command></term>
425 <listitem>
426 <para>
427 is a wrapper script to the <command>java</command> command
428 which sets up the <application>fop</application>
429 environment and passes the required parameters
430 </para>
431 <indexterm zone="fop fop-prog">
432 <primary sortas="b-fop">fop</primary>
433 </indexterm>
434 </listitem>
435 </varlistentry>
436
437 <varlistentry id="fop.jar">
438 <term><filename class="libraryfile">fop.jar</filename></term>
439 <listitem>
440 <para>
441 contains all the <application>fop</application>
442 <application>Java</application> classes
443 </para>
444 <indexterm zone="fop fop.jar">
445 <primary sortas="c-fop.jar">fop.jar</primary>
446 </indexterm>
447 </listitem>
448 </varlistentry>
449
450 </variablelist>
451
452 </sect2>
453
454</sect1>
Note: See TracBrowser for help on using the repository browser.