You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configuration.xml 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <?xml version="1.0" standalone="no"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!-- $Id$ -->
  17. <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
  18. <document>
  19. <header>
  20. <title>Apache FOP: Configuration</title>
  21. <version>$Revision$</version>
  22. </header>
  23. <body>
  24. <section id="general">
  25. <title>Configuration File Basics</title>
  26. <p>
  27. The FOP configuration file is an XML file containing a variety of settings that are useful
  28. for controlling FOP's behavior, and for helping it find resources that you wish it to use.
  29. </p>
  30. <p>
  31. The easiest way to get started using a FOP configuration file is to copy the sample found
  32. at <code>{fop-dir}/conf/fop.xconf</code> to a location of your choice, and then to
  33. edit it according to your needs.
  34. It contains templates for the various configuration options, most of which are commented
  35. out. Remove the comments and change the settings for entries that you wish to use.
  36. Be sure to follow any instructions, including comments which specify the value range.
  37. Also, since the configuration file is XML, be sure to keep it well-formed.
  38. </p>
  39. <section id="general-available">
  40. <title>Making Configuration Available to FOP</title>
  41. <p>After creating your configuration file, you must tell FOP how to find it:</p>
  42. <ul>
  43. <li>
  44. If running FOP from the command-line, see the "-c" command-line option in
  45. <a href="running.html">Running FOP</a>.
  46. </li>
  47. <li>
  48. If running FOP as an embedded application, see
  49. <a href="embedding.html#config-external">Embedding, Using a Configuration File</a>.
  50. </li>
  51. </ul>
  52. <p>
  53. See <a href="embedding.html#config-internal">Setting the Configuration Programmatically</a>
  54. for instructions on how to do so in an embedded environment.
  55. </p>
  56. </section>
  57. </section>
  58. <section id="general-elements">
  59. <title>Summary of the General Configuration Options</title>
  60. <table>
  61. <tr>
  62. <th>Element</th>
  63. <th>Data Type (for the value)</th>
  64. <th>Description</th>
  65. <th>Default Value</th>
  66. </tr>
  67. <tr>
  68. <td>base</td>
  69. <td>URL or directory</td>
  70. <td>Specifies the base URL based on which relative URL will be resolved.</td>
  71. <td>current directory</td>
  72. </tr>
  73. <tr>
  74. <td>font-base</td>
  75. <td>URL or directory</td>
  76. <td>Specifies the base URL based on which relative font URLs will be resolved.
  77. </td>
  78. <td>base URL/directory (above)</td>
  79. </tr>
  80. <tr>
  81. <td>hyphenation-base</td>
  82. <td>URL or directory</td>
  83. <td>Specifies the base URL based on which relative URLs to hyphenation pattern
  84. files will be resolved. If not specified, support for user-supplied hyphenation
  85. patterns remains disabled.
  86. </td>
  87. <td>disabled</td>
  88. </tr>
  89. <tr>
  90. <td>source-resolution</td>
  91. <td>Integer, dpi</td>
  92. <td>
  93. Resolution in dpi (dots per inch) which is used internally to determine the pixel
  94. size for SVG images and bitmap images without resolution information.
  95. </td>
  96. <td>72 dpi</td>
  97. </tr>
  98. <tr>
  99. <td>target-resolution</td>
  100. <td>Integer, dpi</td>
  101. <td>
  102. Resolution in dpi (dots per inch) used to specify the output resolution for bitmap
  103. images generated by bitmap renderers (such as the TIFF renderer) and by bitmaps
  104. generated by Apache Batik for filter effects and such.
  105. </td>
  106. <td>72 dpi</td>
  107. </tr>
  108. <tr>
  109. <td>strict-configuration</td>
  110. <td>Boolean (true, false)</td>
  111. <td>
  112. Setting this option to 'true' will cause FOP to strictly verify the contents of the
  113. FOP configuration file to ensure that defined resources (such as fonts and base
  114. URLs/directories) are valid and available to FOP. Any errors found will cause FOP to
  115. immediately raise an exception.</td>
  116. <td>false</td>
  117. </tr>
  118. <tr>
  119. <td>strict-validation</td>
  120. <td>Boolean (true, false)</td>
  121. <td>
  122. Setting this option to 'false' causes FOP to be more forgiving about XSL-FO validity,
  123. for example, you're allowed to specify a border on a region-body which is supported
  124. by some FO implementations but is non-standard. Note that such a border would
  125. currently have no effect in Apache FOP.</td>
  126. <td>true</td>
  127. </tr>
  128. <tr>
  129. <td>break-indent-inheritance</td>
  130. <td>Boolean (true, false)</td>
  131. <td>
  132. Setting this option to 'true' causes FOP to use an alternative rule set to determine
  133. text indents specified through margins, start-indent and end-indent. Many commercial
  134. FO implementations have chosen to break the XSL specification in this aspect. This
  135. option tries to mimic their behaviour. Please note that Apache FOP may still not
  136. behave exactly like those implementations either because FOP has not fully matched
  137. the desired behaviour and because the behaviour among the commercial implementations
  138. varies. The default for this option (i.e. false) is to behave exactly like the
  139. specification describes.</td>
  140. <td>false</td>
  141. </tr>
  142. <tr>
  143. <td>default-page-settings</td>
  144. <td>n/a</td>
  145. <td>
  146. Specifies the default width and height of a page if "auto" is specified
  147. for either or both values. Use "height" and "width" attributes on the
  148. default-page-settings element to specify the two values.</td>
  149. <td>"height" 11 inches, "width" 8.26 inches</td>
  150. </tr>
  151. <tr>
  152. <td>use-cache</td>
  153. <td>boolean (true, false)</td>
  154. <td>All fonts information that has been gathered as a result of "directory"
  155. or "auto-detect" font configurations will be cached for future rendering runs.
  156. This setting should improve performance on systems where
  157. fonts have been configured using the "directory" or "auto-detect" tag mechanisms.
  158. By default this option is switched on.</td>
  159. <td>true</td>
  160. </tr>
  161. <tr>
  162. <td>cache-file</td>
  163. <td>String</td>
  164. <td>This options specifies the file/directory path of the fop cache file.
  165. This option can also be specified on the command-line using the -cache option.
  166. This file is currently only used to cache font triplet information for future reference.</td>
  167. <td>${base}/conf/fop.cache</td>
  168. </tr>
  169. <tr>
  170. <td>renderers</td>
  171. <td>(see text below)</td>
  172. <td>Contains the configuration for each renderer. See below.</td>
  173. <td>N/A</td>
  174. </tr>
  175. </table>
  176. <p>
  177. This is an excerpt from the example configuration file coming with FOP:
  178. </p>
  179. <source><![CDATA[
  180. <fop version="1.0">
  181. <!-- Strict user configuration -->
  182. <strict-configuration>true</strict-configuration>
  183. <!-- Strict FO validation -->
  184. <strict-validation>true</strict-validation>
  185. <!-- Base URL for resolving relative URLs -->
  186. <base>./</base>
  187. <!-- Font Base URL for resolving relative font URLs -->
  188. <font-base>./</font-base>
  189. <!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
  190. <source-resolution>72</source-resolution>
  191. <!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
  192. <target-resolution>72</target-resolution>
  193. <!-- default page-height and page-width, in case
  194. value is specified as auto -->
  195. <default-page-settings height="11in" width="8.26in"/>
  196. <!-- etc. etc..... -->
  197. </fop>]]></source>
  198. </section>
  199. <section id="renderers">
  200. <title>Renderer configuration</title>
  201. <p>
  202. Each Renderer has its own configuration section which is identified by the
  203. MIME type the Renderer is written for, ex. "application/pdf" for the PDF Renderer.
  204. </p>
  205. <p>
  206. The configuration for the PDF Renderer could look like this:
  207. </p>
  208. <source><![CDATA[
  209. <renderers>
  210. <renderer mime="application/pdf">
  211. <filterList>
  212. <!-- provides compression using zlib flate (default is on) -->
  213. <value>flate</value>
  214. </filterList>
  215. <fonts>
  216. <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
  217. <font-triplet name="Arial" style="normal" weight="normal"/>
  218. <font-triplet name="ArialMT" style="normal" weight="normal"/>
  219. </font>
  220. <font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
  221. <font-triplet name="Arial" style="normal" weight="bold"/>
  222. <font-triplet name="ArialMT" style="normal" weight="bold"/>
  223. </font>
  224. </fonts>
  225. </renderer>
  226. <renderer mime="application/postscript">
  227. <!-- etc. etc..... -->]]></source>
  228. <p>
  229. The details on the font configuration can be found on the separate <a href="fonts.html">Fonts</a> page.
  230. Note especially the section entitled <a href="fonts.html#register">Register Fonts with FOP</a>.
  231. </p>
  232. <section id="pdf-renderer">
  233. <title>Special Settings for the PDF Renderer</title>
  234. <p>
  235. The configuration element for the PDF renderer contains two elements. One is for the font configuration
  236. (please follow the link above) and one is for the "filter list". The filter list controls how the
  237. individual objects in a PDF file are encoded. By default, all objects get "flate" encoded (i.e. simply
  238. compressed with the same algorithm that is also used in ZIP files). Most users don't need to change that
  239. setting. For debugging purposes, it may be desired not to compress the internal objects at all so the
  240. generated PDF commands can be read. In that case, you can simply use the following filter list. The
  241. second filter list (type="image") ensures that all images still get compressed but also ASCII-85 encoded
  242. so the produced PDF file is still easily readable in a text editor.
  243. </p>
  244. <source><![CDATA[
  245. <renderer mime="application/pdf">
  246. <filterList>
  247. <value>null</value>
  248. </filterList>
  249. <filterList type="image">
  250. <value>flate</value>
  251. <value>ascii-85</value>
  252. </filterList>
  253. <fonts....
  254. </renderer>]]></source>
  255. <p>
  256. Another (optional) setting specific to the PDF Renderer is an output color profile, an ICC
  257. color profile which indicates the target color space the PDF file is generated for. This
  258. setting is mainly used in conjunction with the <a href="pdfx.html">PDF/X</a> feature.
  259. An example:
  260. </p>
  261. <source><![CDATA[
  262. <renderer mime="application/pdf">
  263. <filterList...
  264. <output-profile>C:\FOP\Color\EuropeISOCoatedFOGRA27.icc</output-profile>
  265. <fonts....
  266. </renderer>]]></source>
  267. <p>
  268. Some people don't have high requirements on color fidelity but instead want the smallest
  269. PDF file sizes possible. In this case it's possible to disable the default sRGB color space
  270. which XSL-FO requires. This will cause RGB colors to be generated as device-specific RGB.
  271. Please note that this option is unavailable (and will cause an error) if you enable
  272. PDF/A or PDF/X functionality or if you specify an output profile. This setting will make the
  273. PDF about 4KB smaller. To disable the sRGB color space add the following setting:
  274. </p>
  275. <source><![CDATA[
  276. <renderer mime="application/pdf">
  277. <filterList...
  278. <disable-srgb-colorspace>true</disable-srgb-colorspace>
  279. <fonts....
  280. </renderer>]]></source>
  281. </section>
  282. <section id="ps-renderer">
  283. <title>Special Settings for the PostScript Renderer</title>
  284. <p>
  285. Besides the normal font configuration (the same "fonts" element as for the PDF renderer) the PostScript
  286. renderer has an additional setting to force landscape pages to be rotated to fit on a page inserted into
  287. the printer in portrait mode. Set the value to "true" to activate this feature. The default is "false".
  288. Example:
  289. </p>
  290. <source><![CDATA[
  291. <renderer mime="application/postscript">
  292. <auto-rotate-landscape>true</auto-rotate-landscape>
  293. <fonts>
  294. <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
  295. <font-triplet name="Arial" style="normal" weight="normal"/>
  296. <font-triplet name="ArialMT" style="normal" weight="normal"/>
  297. </font>
  298. <font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
  299. <font-triplet name="Arial" style="normal" weight="bold"/>
  300. <font-triplet name="ArialMT" style="normal" weight="bold"/>
  301. </font>
  302. </fonts>
  303. </renderer>]]></source>
  304. </section>
  305. <section id="pcl-renderer">
  306. <title>Special Settings for the PCL Renderer</title>
  307. <p>
  308. Non-standard fonts for the PCL renderer are made available through the Java2D subsystem which means that
  309. you don't have to do any custom font configuration in this case but you have to use the font names
  310. offered by Java.
  311. </p>
  312. <p>
  313. Additionally, there are certain settings that control how the renderer handles various elements.
  314. </p>
  315. <source><![CDATA[<renderer mime="application/vnd.hp-PCL">
  316. <rendering>quality</rendering>
  317. <text-rendering>bitmap</text-rendering>
  318. </renderer>]]></source>
  319. <p>
  320. The default value for the "rendering" setting is "speed" which causes borders
  321. to be painted as plain rectangles. In this mode, no special borders (dotted,
  322. dashed etc.) are available. If you want support for all border modes, set the
  323. value to "quality" as indicated above. This will cause the borders to be painted
  324. as bitmaps.
  325. </p>
  326. <p>
  327. The default value for the "text-rendering" setting is "auto" which paints the
  328. base fonts using PCL fonts. Non-base fonts are painted as bitmaps through Java2D.
  329. If the mix of painting methods results in unwelcome output, you can set this
  330. to "bitmap" which causes all text to be rendered as bitmaps.
  331. </p>
  332. </section>
  333. </section>
  334. <section>
  335. <title>When it does not work</title>
  336. <p>FOP searches the configuration file for the information it
  337. expects, at the position it expects. When that information is not
  338. present, FOP will not complain, it will just continue. When there is
  339. other information in the file, FOP will not complain, it will just
  340. ignore it. That means that when your configuration information is in
  341. the file but in a different XML element, or in a different XML path,
  342. than FOP expects, it will be silently ignored.</p>
  343. <p>Check the following possibilities:</p>
  344. <ul>
  345. <li>The format of the configuration file has changed
  346. considerably between FOP 0.20.5 and FOP 1.0 and its beta versions. Did
  347. you convert your file to the new format?</li>
  348. <li>The FOP distribution contains a schema for configuration
  349. files, at src/foschema/fop-configuration.xsd. Did you validate your
  350. configuration file against it? Add the following schema location to
  351. the <code>schema</code> element:
  352. <source><![CDATA[<fop
  353. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  354. xsi:noNamespaceSchemaLocation=
  355. "http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co">]]>
  356. </source>
  357. and run the configuration file through a validating schema
  358. parser. Note that the schema cannot detect all errors, and that it is
  359. stricter about the order of some elements than FOP itself is.</li>
  360. <li>Run FOP in debug mode (command line option
  361. <code>-d</code>). This makes FOP report which configuration
  362. information it finds. Check if FOP finds what you expect.</li>
  363. </ul>
  364. </section>
  365. </body>
  366. </document>