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 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. <p>FOP supports encryption of PDF output, thanks to Patrick C. Lankswert.
  282. This feature is commonly used to prevent unauthorized viewing, printing, editing, copying text
  283. from the document and doing annotations. It is also possible to ask the user for a password in
  284. order to view the contents. Note that there already exist third party applications which can
  285. decrypt an encrypted PDF without effort and allow the aforementioned operations, therefore the
  286. degree of protection is limited. For further information about features and restrictions
  287. regarding PDF encryption, look at the documentation coming with Adobe Acrobat or the technical
  288. documentation on the Adobe web site.</p>
  289. <source><![CDATA[
  290. <renderer mime="application/pdf">
  291. <encryption-params>
  292. <user-password>testuserpass</user-password>
  293. <owner-password>testownerpass</owner-password>
  294. <noprint/>
  295. <nocopy/>
  296. <noedit/>
  297. <noannotations/>
  298. </encryption-params>
  299. </renderer>]]></source>
  300. </section>
  301. <section id="ps-renderer">
  302. <title>Special Settings for the PostScript Renderer</title>
  303. <p>
  304. Besides the normal font configuration (the same "fonts" element as for the PDF renderer) the PostScript
  305. renderer has an additional setting to force landscape pages to be rotated to fit on a page inserted into
  306. the printer in portrait mode. Set the value to "true" to activate this feature. The default is "false".
  307. Example:
  308. </p>
  309. <source><![CDATA[
  310. <renderer mime="application/postscript">
  311. <auto-rotate-landscape>true</auto-rotate-landscape>
  312. <fonts>
  313. <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
  314. <font-triplet name="Arial" style="normal" weight="normal"/>
  315. <font-triplet name="ArialMT" style="normal" weight="normal"/>
  316. </font>
  317. <font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
  318. <font-triplet name="Arial" style="normal" weight="bold"/>
  319. <font-triplet name="ArialMT" style="normal" weight="bold"/>
  320. </font>
  321. </fonts>
  322. </renderer>]]></source>
  323. </section>
  324. <section id="pcl-renderer">
  325. <title>Special Settings for the PCL Renderer</title>
  326. <p>
  327. Non-standard fonts for the PCL renderer are made available through the Java2D subsystem which means that
  328. you don't have to do any custom font configuration in this case but you have to use the font names
  329. offered by Java.
  330. </p>
  331. <p>
  332. Additionally, there are certain settings that control how the renderer handles various elements.
  333. </p>
  334. <source><![CDATA[<renderer mime="application/vnd.hp-PCL">
  335. <rendering>quality</rendering>
  336. <text-rendering>bitmap</text-rendering>
  337. </renderer>]]></source>
  338. <p>
  339. The default value for the "rendering" setting is "speed" which causes borders
  340. to be painted as plain rectangles. In this mode, no special borders (dotted,
  341. dashed etc.) are available. If you want support for all border modes, set the
  342. value to "quality" as indicated above. This will cause the borders to be painted
  343. as bitmaps.
  344. </p>
  345. <p>
  346. The default value for the "text-rendering" setting is "auto" which paints the
  347. base fonts using PCL fonts. Non-base fonts are painted as bitmaps through Java2D.
  348. If the mix of painting methods results in unwelcome output, you can set this
  349. to "bitmap" which causes all text to be rendered as bitmaps.
  350. </p>
  351. </section>
  352. <section id="afp-renderer">
  353. <title>Special Settings for the AFP Renderer</title>
  354. <p>
  355. </p>
  356. <p>
  357. Additionally, there are certain settings that control how the renderer handles various elements.
  358. </p>
  359. <source><![CDATA[<renderer mime="application/x-afp">
  360. <images mode="b+w" bits-per-pixel="8" native="true"/>
  361. <renderer-resolution>240</renderer-resolution>
  362. <!-- a default external resource group file -->
  363. <resource-group-file>resources.afp</resource-group-file>
  364. </renderer>]]></source>
  365. <p>
  366. 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.
  367. 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.
  368. </p>
  369. <p>
  370. The default value for the "renderer-resolution" is 240 dpi.
  371. </p>
  372. <!--
  373. <p>
  374. 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).
  375. </p>
  376. -->
  377. <p>
  378. By default if there is no configuration definition for "resource-group-file", external resources will be placed in a file called resources.afp.
  379. </p>
  380. </section>
  381. </section>
  382. <section>
  383. <title>When it does not work</title>
  384. <p>FOP searches the configuration file for the information it
  385. expects, at the position it expects. When that information is not
  386. present, FOP will not complain, it will just continue. When there is
  387. other information in the file, FOP will not complain, it will just
  388. ignore it. That means that when your configuration information is in
  389. the file but in a different XML element, or in a different XML path,
  390. than FOP expects, it will be silently ignored.</p>
  391. <p>Check the following possibilities:</p>
  392. <ul>
  393. <li>The format of the configuration file has changed
  394. considerably between FOP 0.20.5 and FOP 1.0 and its beta versions. Did
  395. you convert your file to the new format?</li>
  396. <li>The FOP distribution contains a schema for configuration
  397. files, at src/foschema/fop-configuration.xsd. Did you validate your
  398. configuration file against it? Add the following schema location to
  399. the <code>schema</code> element:
  400. <source><![CDATA[<fop
  401. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  402. xsi:noNamespaceSchemaLocation=
  403. "http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co">]]>
  404. </source>
  405. and run the configuration file through a validating schema
  406. parser. Note that the schema cannot detect all errors, and that it is
  407. stricter about the order of some elements than FOP itself is.</li>
  408. <li>Run FOP in debug mode (command line option
  409. <code>-d</code>). This makes FOP report which configuration
  410. information it finds. Check if FOP finds what you expect.</li>
  411. </ul>
  412. </section>
  413. </body>
  414. </document>