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.

anttask.xml 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 V1.1//EN"
  18. "http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-forrest/src/core/context/resources/schema/dtd/document-v12.dtd">
  19. <document>
  20. <header>
  21. <title>Ant task</title>
  22. <version>$Revision$</version>
  23. </header>
  24. <body>
  25. <p>
  26. FOP provides an Ant task for automating the document build process.</p>
  27. <section id="basics"><title>Description</title>
  28. <p>
  29. The FOP Ant task will convert XSL-FO documents to PDF/PS/PCL/MIF/RTF output
  30. (see <link href="output.html">Output formats</link> for available formats).</p>
  31. <p>
  32. To call FOP tasks within Ant, first add a FOP task definition to your Ant build file.
  33. One method of defining the task is as follows:
  34. </p>
  35. <source><![CDATA[
  36. <property name="fop.dir" value="....path to your FOP jar files..."/>
  37. <taskdef name="fop"
  38. classname="org.apache.fop.tools.anttasks.Fop">
  39. <classpath>
  40. <pathelement location="${fop.dir}\fop.jar"/>
  41. <pathelement location="${fop.dir}\avalon.jar"/>
  42. <pathelement location="${fop.dir}\batik.jar"/>
  43. </classpath>
  44. </taskdef>
  45. ]]></source>
  46. <p>
  47. Then create FOP tasks within your Ant build file, using the FOP task parameters listed below.</p>
  48. </section>
  49. <!-- TODO: Installation/Configuration -->
  50. <section id="parameters"><title>Parameters for FOP Ant task</title>
  51. <table><caption>Parameters specified as attributes</caption>
  52. <tr>
  53. <th>Attribute</th>
  54. <th>Description</th>
  55. <th>Required</th>
  56. </tr>
  57. <tr>
  58. <td>fofile</td>
  59. <td>XSL-FO file to be rendered</td>
  60. <td>Yes, if no fileset nested element is used</td>
  61. </tr>
  62. <tr>
  63. <td>outfile</td>
  64. <td>Output filename</td>
  65. <td>Yes, when fofile is used. (This attribute is not valid for filesets.)</td>
  66. </tr>
  67. <tr>
  68. <td>format</td>
  69. <td>Possible output formats:<br/>
  70. <code>application/pdf</code><br/>
  71. <code>application/postscript</code><br/>
  72. <code>application/vnd.mif</code><br/>
  73. <code>application/rtf</code><br/>
  74. <code>application/vnd.hp-PCL</code><br/>
  75. <code>text/plain</code><br/>
  76. <code>text/xml</code><br/>
  77. </td>
  78. <td>No, defaults to <code>application/pdf</code></td>
  79. </tr>
  80. <tr>
  81. <td>outdir</td>
  82. <td>Output directory</td>
  83. <td>Required if a fileset is used to specify the files to render; optional for fofile. (Can alternatively specify the full path in the fofile value.)</td>
  84. </tr>
  85. <tr>
  86. <td>force</td>
  87. <td>Recreate target files, even if they are newer than their corresponding
  88. source files. Note: This attribute is available in post-0.20.5
  89. versions (0.20.x nightly build and 1.0dev) only; target files are
  90. always generated (i.e., force=true) in 0.20.5 release.
  91. </td>
  92. <td>No, default is <code>false</code></td>
  93. </tr>
  94. <tr>
  95. <td>basedir</td>
  96. <td>Base directory to resolve relative references (e.g., graphics files) within the
  97. FO document.
  98. </td>
  99. <td>No, for single FO File entry, default is to use the location
  100. of that FO file.
  101. </td>
  102. </tr>
  103. <tr>
  104. <td>relativebase</td>
  105. <td>For fileset usage only. A value of <code>true</code> specifies using the location
  106. of each .fo file as the base directory for resolving relative file references located
  107. within that .fo file. A value of <code>false</code> specifies using the value of
  108. basedir for all files within the fileset, or just the current working directory
  109. if basedir is not specified.
  110. </td>
  111. <td>No, default is <code>false</code>.
  112. </td>
  113. </tr>
  114. <tr>
  115. <td>userconfig</td>
  116. <td>User configuration file (same as the FOP "-c" command line option)</td>
  117. <td>No</td>
  118. </tr>
  119. <tr>
  120. <td>messagelevel</td>
  121. <td>Logging level<br/>
  122. Possible values: <code>error</code>, <code>warn</code>, <code>info</code>, <code>verbose</code>, <code>debug</code></td>
  123. <td>No, defaults to <code>verbose</code></td>
  124. </tr>
  125. <tr>
  126. <td>logFiles</td>
  127. <td>Controls whether the names of the files that are processed are logged
  128. (<code>true</code>) or not (<code>false</code>)</td>
  129. <td>No, default is <code>true</code></td>
  130. </tr>
  131. </table>
  132. <p/>
  133. <table><caption>Parameters specified as nested elements</caption>
  134. <tr>
  135. <th>Attribute</th>
  136. <th>Description</th>
  137. <th>Required</th>
  138. </tr>
  139. <tr>
  140. <td>fileset</td>
  141. <td><link href="http://ant.apache.org/manual/CoreTypes/fileset.html">FileSets</link>
  142. are used to specify multiple XSL-FO files to be rendered.</td>
  143. <td>Yes, if no fofile attribute is supplied</td>
  144. </tr>
  145. </table>
  146. </section>
  147. <section id="examples">
  148. <title>Examples</title>
  149. <p>
  150. The following example converts a single XSL-FO file to a PDF document:
  151. </p>
  152. <source><![CDATA[
  153. <target name="generate-pdf" description="Generates a single PDF file">
  154. <fop format="application/pdf"
  155. fofile="c:\working\foDirectory\foDocument.fo"
  156. outfile="c:\working\pdfDirectory\pdfDocument.pdf" />
  157. </target>
  158. ]]></source>
  159. <p>
  160. This example converts all XSL-FO files within an entire directory to PostScript:
  161. </p>
  162. <source><![CDATA[
  163. <target name="generate-multiple-ps"
  164. description="Generates multiple PostScript files">
  165. <fop format="application/postscript"
  166. outdir="${build.dir}" messagelevel="debug">
  167. <fileset dir="${fo.examples.dir}">
  168. <include name="*.fo"/>
  169. </fileset>
  170. </fop>
  171. </target>
  172. ]]></source>
  173. </section>
  174. </body>
  175. </document>