1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
|
<?xml version="1.0" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Id$ -->
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
<document>
<header>
<title>Apache FOP: Configuration</title>
<version>$Revision$</version>
</header>
<body>
<section id="general">
<title>Configuration File Basics</title>
<p>
The FOP configuration file is an XML file containing a variety of settings that are useful
for controlling FOP's behavior, and for helping it find resources that you wish it to use.
</p>
<p>
The easiest way to get started using a FOP configuration file is to copy the sample found
at <code>{fop-dir}/conf/fop.xconf</code> to a location of your choice, and then to
edit it according to your needs.
It contains templates for the various configuration options, most of which are commented
out. Remove the comments and change the settings for entries that you wish to use.
Be sure to follow any instructions, including comments which specify the value range.
Also, since the configuration file is XML, be sure to keep it well-formed.
</p>
<section id="general-available">
<title>Making Configuration Available to FOP</title>
<p>After creating your configuration file, you must tell FOP how to find it:</p>
<ul>
<li>
If running FOP from the command-line, see the "-c" command-line option in
<a href="running.html">Running FOP</a>.
</li>
<li>
If running FOP as an embedded application, see
<a href="embedding.html#config-external">Embedding, Using a Configuration File</a>.
</li>
</ul>
<p>
See <a href="embedding.html#config-internal">Setting the Configuration Programmatically</a>
for instructions on how to do so in an embedded environment.
</p>
</section>
</section>
<section id="general-elements">
<title>Summary of the General Configuration Options</title>
<table>
<tr>
<th>Element</th>
<th>Data Type (for the value)</th>
<th>Description</th>
<th>Default Value</th>
</tr>
<tr>
<td>base</td>
<td>URL or directory</td>
<td>Specifies the base URL based on which relative URL will be resolved.</td>
<td>current directory</td>
</tr>
<tr>
<td>font-base</td>
<td>URL or directory</td>
<td>Specifies the base URL based on which relative font URLs will be resolved.
</td>
<td>base URL/directory (above)</td>
</tr>
<tr>
<td>hyphenation-base</td>
<td>URL or directory</td>
<td>Specifies the base URL based on which relative URLs to hyphenation pattern
files will be resolved. If not specified, support for user-supplied hyphenation
patterns remains disabled.
</td>
<td>disabled</td>
</tr>
<tr>
<td>hyphenation-pattern</td>
<td>String, attribute lang, attribute country (optional)</td>
<td>Register a file name for the hyphenation pattern for the mentioned language and country. Language ll and country CC must both consist of two letters.</td>
<td>ll_CC</td>
</tr>
<tr>
<td>source-resolution</td>
<td>Integer, dpi</td>
<td>
Resolution in dpi (dots per inch) which is used internally to determine the pixel
size for SVG images and bitmap images without resolution information.
</td>
<td>72 dpi</td>
</tr>
<tr>
<td>target-resolution</td>
<td>Integer, dpi</td>
<td>
Resolution in dpi (dots per inch) used to specify the output resolution for bitmap
images generated by bitmap renderers (such as the TIFF renderer) and by bitmaps
generated by Apache Batik for filter effects and such.
</td>
<td>72 dpi</td>
</tr>
<tr>
<td>strict-configuration</td>
<td>Boolean (true, false)</td>
<td>
Setting this option to 'true' will cause FOP to strictly verify the contents of the
FOP configuration file to ensure that defined resources (such as fonts and base
URLs/directories) are valid and available to FOP. Any errors found will cause FOP to
immediately raise an exception.</td>
<td>false</td>
</tr>
<tr>
<td>strict-validation</td>
<td>Boolean (true, false)</td>
<td>
Setting this option to 'false' causes FOP to be more forgiving about XSL-FO validity,
for example, you're allowed to specify a border on a region-body which is supported
by some FO implementations but is non-standard. Note that such a border would
currently have no effect in Apache FOP.</td>
<td>true</td>
</tr>
<tr>
<td>break-indent-inheritance</td>
<td>Boolean (true, false)</td>
<td>
Setting this option to 'true' causes FOP to use an alternative rule set to determine
text indents specified through margins, start-indent and end-indent. Many commercial
FO implementations have chosen to break the XSL specification in this aspect. This
option tries to mimic their behaviour. Please note that Apache FOP may still not
behave exactly like those implementations either because FOP has not fully matched
the desired behaviour and because the behaviour among the commercial implementations
varies. The default for this option (i.e. false) is to behave exactly like the
specification describes.</td>
<td>false</td>
</tr>
<tr>
<td>default-page-settings</td>
<td>n/a</td>
<td>
Specifies the default width and height of a page if "auto" is specified
for either or both values. Use "height" and "width" attributes on the
default-page-settings element to specify the two values.</td>
<td>"height" 11 inches, "width" 8.26 inches</td>
</tr>
<!-- Disabled: no simultaneous Renderer and IF implementations at the moment
<tr>
<td>prefer-renderer</td>
<td>boolean (true, false)</td>
<td>
By default, FOP prefers the newer output implementations based on the
<code>IFDocumentHandler</code> interface. If no such implementation can be found for
a given MIME type, it looks for an implementation of the <code>Renderer</code> interface.
If necessary, you can invert the lookup order to prefer the Renderer variant over the
IFDocumentHandler variant by setting this value to true.
</td>
<td>false</td>
</tr>
-->
<tr>
<td>use-cache</td>
<td>boolean (true, false)</td>
<td>All fonts information that has been gathered as a result of "directory"
or "auto-detect" font configurations will be cached for future rendering runs.
This setting should improve performance on systems where
fonts have been configured using the "directory" or "auto-detect" tag mechanisms.
By default this option is switched on.</td>
<td>true</td>
</tr>
<tr>
<td>cache-file</td>
<td>String</td>
<td>This option specifies the file/directory path of the fop cache file.
This file is currently only used to cache font triplet information for future reference.</td>
<td>${base}/conf/fop.cache</td>
</tr>
<tr>
<td>renderers</td>
<td>(see text below)</td>
<td>Contains the configuration for each renderer. See below.</td>
<td>N/A</td>
</tr>
</table>
<p>
This is an excerpt from the example configuration file coming with FOP:
</p>
<source><![CDATA[
<fop version="1.0">
<!-- Strict user configuration -->
<strict-configuration>true</strict-configuration>
<!-- Strict FO validation -->
<strict-validation>true</strict-validation>
<!-- Base URL for resolving relative URLs -->
<base>./</base>
<!-- Font Base URL for resolving relative font URLs -->
<font-base>./</font-base>
<!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
<source-resolution>72</source-resolution>
<!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
<target-resolution>72</target-resolution>
<!-- default page-height and page-width, in case
value is specified as auto -->
<default-page-settings height="11in" width="8.26in"/>
<!-- Use file name nl_Bel instead of the default nl_BE -->
<hyphenation-pattern lang="nl" country="BE">nl_Bel</hyphenation-pattern>
<!-- etc. etc..... -->
</fop>]]></source>
</section>
<section id="image-loading">
<title>Image Loading Customization</title>
<p>
Apache FOP uses the image loading framework from
<a href="http://xmlgraphics.apache.org/commons/">Apache XML Graphics Commons</a> to load
images using various plug-ins. Every image loader plug-in has a hard-coded usage penalty
that influences which solution is chosen if there are multiple possibilities to load an image.
Sometimes, though, these penalties need to be tweaked and this can be done in the FOP
configuration. An example:
</p>
<source><![CDATA[<fop version="1.0">
[..]
<image-loading>
<penalty value="10000"
class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawCCITTFax"/>
<penalty value="INFINITE"
class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderInternalTIFF"/>
</image-loading>
<renderers....
</fop>]]></source>
<p>
The first penalty element increases the penalty for the raw CCITT loader. This practically
forces the decoding of CCITT compressed TIFF images except if there are no TIFF codecs
available.
</p>
<p>
The second penalty element sets an "infinite" penalty for the TIFF loader using the internal
TIFF codec. This practically disables that plug-in as it will never be chosen as a possible
solution.
</p>
<p>
Negative penalties are possible to promote a plug-in but a negative penalty sum will be
treated as zero penalty in most cases. For more details on the image loading framework,
please consult the documentation there.
</p>
</section>
<section id="renderers">
<title>Renderer configuration</title>
<p>
Each Renderer has its own configuration section which is identified by the
MIME type the Renderer is written for, ex. "application/pdf" for the PDF Renderer.
</p>
<p>
The configuration for the PDF Renderer could look like this:
</p>
<source><![CDATA[
<renderers>
<renderer mime="application/pdf">
<filterList>
<!-- provides compression using zlib flate (default is on) -->
<value>flate</value>
</filterList>
<fonts>
<font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
<font-triplet name="Arial" style="normal" weight="normal"/>
<font-triplet name="ArialMT" style="normal" weight="normal"/>
</font>
<font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
<font-triplet name="Arial" style="normal" weight="bold"/>
<font-triplet name="ArialMT" style="normal" weight="bold"/>
</font>
</fonts>
</renderer>
<renderer mime="application/postscript">
<!-- etc. etc..... -->]]></source>
<p>
The details on the font configuration can be found on the separate <a href="fonts.html">Fonts</a> page.
Note especially the section entitled <a href="fonts.html#register">Register Fonts with FOP</a>.
</p>
<section id="pdf-renderer">
<title>Special Settings for the PDF Renderer</title>
<p>
The configuration element for the PDF renderer contains two elements. One is for the font configuration
(please follow the link above) and one is for the "filter list". The filter list controls how the
individual objects in a PDF file are encoded. By default, all objects get "flate" encoded (i.e. simply
compressed with the same algorithm that is also used in ZIP files). Most users don't need to change that
setting. For debugging purposes, it may be desired not to compress the internal objects at all so the
generated PDF commands can be read. In that case, you can simply use the following filter list. The
second filter list (type="image") ensures that all images still get compressed but also ASCII-85 encoded
so the produced PDF file is still easily readable in a text editor.
</p>
<source><![CDATA[
<renderer mime="application/pdf">
<filterList>
<value>null</value>
</filterList>
<filterList type="image">
<value>flate</value>
<value>ascii-85</value>
</filterList>
<fonts....
</renderer>]]></source>
<p>
Another (optional) setting specific to the PDF Renderer is an output color profile, an ICC
color profile which indicates the target color space the PDF file is generated for. This
setting is mainly used in conjunction with the <a href="pdfx.html">PDF/X</a> feature.
An example:
</p>
<source><![CDATA[
<renderer mime="application/pdf">
<filterList...
<output-profile>C:\FOP\Color\EuropeISOCoatedFOGRA27.icc</output-profile>
<fonts....
</renderer>]]></source>
<p>
Some people don't have high requirements on color fidelity but instead want the smallest
PDF file sizes possible. In this case it's possible to disable the default sRGB color space
which XSL-FO requires. This will cause RGB colors to be generated as device-specific RGB.
Please note that this option is unavailable (and will cause an error) if you enable
PDF/A or PDF/X functionality or if you specify an output profile. This setting will make the
PDF about 4KB smaller. To disable the sRGB color space add the following setting:
</p>
<source><![CDATA[
<renderer mime="application/pdf">
<filterList...
<disable-srgb-colorspace>true</disable-srgb-colorspace>
<fonts....
</renderer>]]></source>
<p>FOP supports encryption of PDF output, thanks to Patrick C. Lankswert.
This feature is commonly used to prevent unauthorized viewing, printing, editing, copying text
from the document and doing annotations. It is also possible to ask the user for a password in
order to view the contents. Note that there already exist third party applications which can
decrypt an encrypted PDF without effort and allow the aforementioned operations, therefore the
degree of protection is limited. For further information about features and restrictions
regarding PDF encryption, look at the documentation coming with Adobe Acrobat or the technical
documentation on the Adobe web site.</p>
<source><![CDATA[
<renderer mime="application/pdf">
<encryption-params>
<user-password>testuserpass</user-password>
<owner-password>testownerpass</owner-password>
<noprint/>
<nocopy/>
<noedit/>
<noannotations/>
</encryption-params>
</renderer>]]></source>
</section>
<section id="ps-renderer">
<title>Special Settings for the PostScript Renderer</title>
<p>
Besides the normal font configuration (the same "fonts" element as for the PDF renderer) the PostScript
renderer has an additional setting to force landscape pages to be rotated to fit on a page inserted into
the printer in portrait mode. Set the value to "true" to activate this feature. The default is "false".
Example:
</p>
<source><![CDATA[
<renderer mime="application/postscript">
<auto-rotate-landscape>true</auto-rotate-landscape>
<fonts>
<font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
<font-triplet name="Arial" style="normal" weight="normal"/>
<font-triplet name="ArialMT" style="normal" weight="normal"/>
</font>
<font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
<font-triplet name="Arial" style="normal" weight="bold"/>
<font-triplet name="ArialMT" style="normal" weight="bold"/>
</font>
</fonts>
</renderer>]]></source>
</section>
<section id="pcl-renderer">
<title>Special Settings for the PCL Renderer</title>
<p>
Non-standard fonts for the PCL renderer are made available through the Java2D subsystem which means that
you don't have to do any custom font configuration in this case but you have to use the font names
offered by Java.
</p>
<p>
Additionally, there are certain settings that control how the renderer handles various elements.
</p>
<source><![CDATA[<renderer mime="application/vnd.hp-PCL">
<rendering>quality</rendering>
<text-rendering>bitmap</text-rendering>
</renderer>]]></source>
<p>
The default value for the "rendering" setting is "speed" which causes borders
to be painted as plain rectangles. In this mode, no special borders (dotted,
dashed etc.) are available. If you want support for all border modes, set the
value to "quality" as indicated above. This will cause the borders to be painted
as bitmaps.
</p>
<p>
The default value for the "text-rendering" setting is "auto" which paints the
base fonts using PCL fonts. Non-base fonts are painted as bitmaps through Java2D.
If the mix of painting methods results in unwelcome output, you can set this
to "bitmap" which causes all text to be rendered as bitmaps.
</p>
</section>
<section id="afp-renderer">
<title>Special Settings for the AFP Renderer</title>
<p>
</p>
<p>
Additionally, there are certain settings that control how the renderer handles various elements.
</p>
<source><![CDATA[<renderer mime="application/x-afp">
<images mode="b+w" bits-per-pixel="8" native="true"/>
<renderer-resolution>240</renderer-resolution>
<!-- a default external resource group file -->
<resource-group-file>resources.afp</resource-group-file>
</renderer>]]></source>
<p>
The default value for the images "mode" setting is "b+w" (black and white). When the images "mode" setting is "b+w" a "bits-per-pixel" setting can be provided to aid the grayscale conversion process. With this setting all images referenced in your source document are converted to an IOCA FS45 grayscale bitmap image form.
When the setting is "color" all images are converted to an IOCA FS45 color bitmap image form. When "native" setting is "true", all images encountered (TIFF, GIF, JPEG and Encapsulated Postscript etc.) will be embedded directly in the datastream in their native form using a MO:DCA Object Container.
</p>
<p>
The default value for the "renderer-resolution" is 240 dpi.
</p>
<!--
<p>
The default value for the MO:DCA "interchange-set" is "MO:DCA-L". Other compliance settings include presentation interchange sets "MO:DCA-P IS/1" and "MO:DCA-P IS/2" (Resource Groups).
</p>
-->
<p>
By default if there is no configuration definition for "resource-group-file", external resources will be placed in a file called resources.afp.
</p>
</section>
</section>
<section>
<title>When it does not work</title>
<p>FOP searches the configuration file for the information it
expects, at the position it expects. When that information is not
present, FOP will not complain, it will just continue. When there is
other information in the file, FOP will not complain, it will just
ignore it. That means that when your configuration information is in
the file but in a different XML element, or in a different XML path,
than FOP expects, it will be silently ignored.</p>
<p>Check the following possibilities:</p>
<ul>
<li>The format of the configuration file has changed
considerably between FOP 0.20.5 and FOP 1.0 and its beta versions. Did
you convert your file to the new format?</li>
<li>The FOP distribution contains a schema for configuration
files, at src/foschema/fop-configuration.xsd. Did you validate your
configuration file against it? Add the following schema location to
the <code>schema</code> element:
<source><![CDATA[<fop
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co">]]>
</source>
and run the configuration file through a validating schema
parser. Note that the schema cannot detect all errors, and that it is
stricter about the order of some elements than FOP itself is.</li>
<li>Run FOP in debug mode (command line option
<code>-d</code>). This makes FOP report which configuration
information it finds. Check if FOP finds what you expect.</li>
</ul>
</section>
</body>
</document>
|