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.

running.xml 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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>Running Apache FOP</title>
  21. <version>$Revision$</version>
  22. </header>
  23. <body>
  24. <section id="require">
  25. <title>System Requirements</title>
  26. <p>The following software must be installed:</p>
  27. <ul>
  28. <li>
  29. Java 1.4.x or later Runtime Environment.
  30. <ul>
  31. <li>
  32. Many JREs >=1.4 contain older JAXP implementations (which often contain bugs). It's
  33. usually a good idea to replace them with a current implementation.
  34. </li>
  35. </ul>
  36. </li>
  37. <li>
  38. Apache FOP. The <a href="../download.html">FOP distribution</a> includes all libraries that you will
  39. need to run a basic FOP installation. These can be found in the [fop-root]/lib directory. These
  40. libraries include the following:
  41. <ul>
  42. <li><a class="fork" href="ext:xmlgraphics.apache.org/commons">Apache XML Graphics Commons</a>, an shared library for Batik and FOP.</li>
  43. <li><a class="fork" href="ext:batik">Apache Batik</a>, an SVG library.</li>
  44. <li><a class="fork" href="ext:commons-logging">Apache Commons Logging</a>, a logger abstraction kit.</li>
  45. <li><a class="fork" href="ext:commons-io">Apache Commons IO</a>, a library with I/O utilities.</li>
  46. <li><a class="fork" href="ext:excalibur/framework">Apache Excalibur/Avalon Framework</a>, for XML configuration handling.</li>
  47. </ul>
  48. </li>
  49. </ul>
  50. <p>The following software is optional, depending on your needs:</p>
  51. <ul>
  52. <li>
  53. Graphics libraries. Generally, FOP contains direct support for the most important
  54. bitmap image formats (including PNG, JPEG and GIF). See
  55. <a href="graphics.html">FOP: Graphics Formats</a> for details.
  56. </li>
  57. <li>
  58. PDF encryption. See <a href="pdfencryption.html">FOP: PDF Encryption</a> for details.
  59. </li>
  60. </ul>
  61. <p>In addition, the following system requirements apply:</p>
  62. <ul>
  63. <li>
  64. If you will be using FOP to process SVG, you must do so in a graphical environment.
  65. See <a href="graphics.html#batik">FOP: Graphics (Batik)</a> for details.
  66. </li>
  67. </ul>
  68. </section>
  69. <section id="install">
  70. <title>Installation</title>
  71. <section id="install-instruct">
  72. <title>Instructions</title>
  73. <p>
  74. Basic FOP installation consists of first unzipping the <code>.gz</code> file that is the
  75. distribution medium, then unarchiving the resulting <code>.tar</code> file in a
  76. directory/folder that is convenient on your system. Please consult your operating system
  77. documentation or Zip application software documentation for instructions specific to your
  78. site.
  79. </p>
  80. </section>
  81. <section id="install-problems">
  82. <title>Problems</title>
  83. <p>
  84. Some Mac OSX users have experienced filename truncation problems using Stuffit to unzip
  85. and unarchive their distribution media. This is a legacy of older Mac operating systems,
  86. which had a 31-character pathname limit. Several Mac OSX users have recommended that
  87. Mac OSX users use the shell command <code>tar -xzf</code> instead.
  88. </p>
  89. </section>
  90. </section>
  91. <section id="standalone-start">
  92. <title>Starting FOP as a Standalone Application</title>
  93. <section id="fop-script">
  94. <title>Using the fop script or batch file</title>
  95. <p>
  96. The usual and recommended practice for starting FOP from the command line is to run the
  97. batch file fop.bat (Windows) or the shell script fop (Unix/Linux).
  98. These scripts require that the environment variable JAVA_HOME be
  99. set to a path pointing to the appropriate Java installation on your system. Macintosh OSX
  100. includes a Java environment as part of its distribution. We are told by Mac OSX users that
  101. the path to use in this case is <code>/Library/Java/Home</code>. <strong>Caveat:</strong>
  102. We suspect that, as Apple releases new Java environments and as FOP upgrades the minimum
  103. Java requirements, the two will inevitably not match on some systems. Please see
  104. <a href="http://developer.apple.com/java/faq">Java on Mac OSX FAQ</a> for information as
  105. it becomes available.
  106. </p>
  107. <source><![CDATA[
  108. USAGE
  109. Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>
  110. [OPTIONS]
  111. -d debug mode
  112. -x dump configuration settings
  113. -q quiet mode
  114. -c cfg.xml use additional configuration file cfg.xml
  115. -l lang the language to use for user information
  116. -r relaxed/less strict validation (where available)
  117. -dpi xxx target resolution in dots per inch (dpi) where xxx is a number
  118. -s for area tree XML, down to block areas only
  119. -v to show FOP version being used
  120. -o [password] PDF file will be encrypted with option owner password
  121. -u [password] PDF file will be encrypted with option user password
  122. -noprint PDF file will be encrypted without printing permission
  123. -nocopy PDF file will be encrypted without copy content permission
  124. -noedit PDF file will be encrypted without edit content permission
  125. -noannotations PDF file will be encrypted without edit annotation permission
  126. -pdfprofile prof PDF file will be generated with the specified profile
  127. (Examples for prof: PDF/A-1b or PDF/X-3:2003)
  128. [INPUT]
  129. infile xsl:fo input file (the same as the next)
  130. -fo infile xsl:fo input file
  131. -xml infile xml input file, must be used together with -xsl
  132. -atin infile area tree input file
  133. -xsl stylesheet xslt stylesheet
  134. -param name value <value> to use for parameter <name> in xslt stylesheet
  135. (repeat '-param name value' for each parameter)
  136. [OUTPUT]
  137. outfile input will be rendered as PDF into outfile
  138. -pdf outfile input will be rendered as PDF (outfile req'd)
  139. -pdfa1b outfile input will be rendered as PDF/A-1b compliant PDF
  140. (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b")
  141. -awt input will be displayed on screen
  142. -rtf outfile input will be rendered as RTF (outfile req'd)
  143. -pcl outfile input will be rendered as PCL (outfile req'd)
  144. -ps outfile input will be rendered as PostScript (outfile req'd)
  145. -afp outfile input will be rendered as AFP (outfile req'd)
  146. -tiff outfile input will be rendered as TIFF (outfile req'd)
  147. -png outfile input will be rendered as PNG (outfile req'd)
  148. -txt outfile input will be rendered as plain text (outfile req'd)
  149. -at [mime] out representation of area tree as XML (outfile req'd)
  150. specify optional mime output to allow AT to be converted
  151. to final format later
  152. -print input file will be rendered and sent to the printer
  153. see options with "-print help"
  154. -out mime outfile input will be rendered using the given MIME type
  155. (outfile req'd) Example: "-out application/pdf D:\out.pdf"
  156. (Tip: "-out list" prints the list of supported MIME types)
  157. -mif outfile input will be rendered as MIF (FrameMaker) (outfile req'd)
  158. Experimental feature - requires additional fop-sandbox.jar.
  159. -svg outfile input will be rendered as an SVG slides file (outfile req'd)
  160. Experimental feature - requires additional fop-sandbox.jar.
  161. -foout outfile input will only be XSL transformed. The intermediate
  162. XSL-FO file is saved and no rendering is performed.
  163. (Only available if you use -xml and -xsl parameters)
  164. [Examples]
  165. Fop foo.fo foo.pdf
  166. Fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)
  167. Fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
  168. Fop -xml foo.xml -xsl foo.xsl -foout foo.fo
  169. Fop foo.fo -mif foo.mif
  170. Fop foo.fo -rtf foo.rtf
  171. Fop foo.fo -print or Fop -print foo.fo
  172. Fop foo.fo -awt]]></source>
  173. <p>
  174. PDF encryption is only available if FOP was compiled with encryption support
  175. <strong>and</strong> if compatible encryption support is available at run time.
  176. Currently, only the JCE is supported. Check the <a href="pdfencryption.html">Details</a>.
  177. </p>
  178. </section>
  179. <section id="your-own-script">
  180. <title>Writing your own script</title>
  181. <p>FOP's entry point for your own scripts is the class
  182. <code>org.apache.fop.cli.Main</code>. The general pattern for the
  183. command line is: <code>java -classpath &lt;CLASSPATH>
  184. org.apache.fop.cli.Main &lt;arguments></code>. The arguments
  185. consist of the options and infile and outfile specifications
  186. as shown above for the standard scripts. You may wish to review
  187. the standard scripts to make sure that
  188. you get your environment properly configured.
  189. </p>
  190. </section>
  191. <section id="jar-option">
  192. <title>Running with java's <code>-jar</code> option</title>
  193. <p>
  194. As an alternative to the start scripts you can run <code>java
  195. -jar path/to/build/fop.jar &lt;arguments></code>, relying on
  196. FOP to build the classpath for running FOP dynamically, see <a
  197. href="#dynamical-classpath">below</a>. If you use hyphenation,
  198. you must put <code>fop-hyph.jar</code> in the <code>lib</code>
  199. directory.
  200. </p>
  201. <p>You can also run <code>java -jar path/to/fop.jar
  202. &lt;arguments></code>, relying on the <code>Class-Path</code>
  203. entry in the manifest file. This works if you put
  204. <code>fop.jar</code> and all jar files from the <code>lib</code>
  205. directory in a single directory. If you use hyphenation, you
  206. must also put <code>fop-hyph.jar</code> in that directory.</p>
  207. <p>In both cases the arguments consist of the options and
  208. infile and outfile specifications as shown above for the
  209. standard scripts.</p>
  210. </section>
  211. <section id="dynamical-classpath">
  212. <title>FOP's dynamical classpath construction</title>
  213. <p>If FOP is started without a proper classpath, it tries to
  214. add its dependencies dynamically. If the system property
  215. <code>fop.home</code> contains the name of a directory, then
  216. FOP uses that directory as the base directory for its
  217. search. Otherwise the current working directory is the base
  218. directory. If the base directory is called <code>build</code>,
  219. then its parent directory becomes the base directory.</p>
  220. <p>FOP expects to find <code>fop.jar</code> in the
  221. <code>build</code> subdirectory of the base directory, and
  222. adds it to the classpath. Subsequently FOP adds all
  223. <code>jar</code> files in the lib directory to the
  224. classpath. The lib directory is either the <code>lib</code>
  225. subdirectory of the base directory, or, if that does not
  226. exist, the base directory itself.</p>
  227. <p>If the system property <code>fop.optional.lib</code>
  228. contains the name of a directory, then all <code>jar</code>
  229. files in that directory are also added to the classpath. See
  230. the methods <code>getJARList</code> and
  231. <code>checkDependencies</code> in
  232. <code>org.apache.fop.cli.Main</code>.</p>
  233. </section>
  234. </section>
  235. <section id="check-input">
  236. <title>Using Xalan to Check XSL-FO Input</title>
  237. <p>
  238. FOP sessions that use -xml and -xsl input instead of -fo input are actually
  239. controlling two distinct conversions: Tranforming XML to XSL-FO, then formatting
  240. the XSL-FO to PDF (or another FOP output format).
  241. Although FOP controls both of these processes, the first is included merely as
  242. a convenience and for performance reasons.
  243. Only the second is part of FOP's core processing.
  244. If a user has a problem running FOP, it is important to determine which of these
  245. two processes is causing the problem.
  246. If the problem is in the first process, the user's stylesheet is likely the cause.
  247. The FOP development team does not have resources to help with stylesheet issues,
  248. although we have included links to some useful
  249. <a href="../resources.html#specs">Specifications</a> and
  250. <a href="../resources.html#articles">Books/Articles</a>.
  251. If the problem is in the second process, FOP may have a bug or an unimplemented
  252. feature that does require attention from the FOP development team.
  253. </p>
  254. <note>The user is always responsible to provide correct XSL-FO code to FOP.</note>
  255. <p>
  256. In the case of using -xml and -xsl input, although the user is responsible for
  257. the XSL-FO code that is FOP's input, it is not visible to the user. To make the
  258. intermediate FO file visible, the FOP distribution includes the "-foout" option
  259. which causes FOP to run only the first (transformation) step, and write the
  260. results to a file. (See also the Xalan command-line below)
  261. </p>
  262. <note>
  263. When asking for help on the FOP mailing lists, <em>never</em> attach XML and
  264. XSL to illustrate the issue. Always run the XSLT step (-foout) and send the
  265. resulting XSL-FO file instead. Of course, be sure that the XSL-FO file is
  266. correct before sending it.
  267. </note>
  268. <p>
  269. The -foout option works the same way as if you would call the
  270. <a href="http://xml.apache.org/xalan-j/commandline.html">Xalan command-line</a>:
  271. </p>
  272. <p>
  273. <code>java org.apache.xalan.xslt.Process -IN xmlfile -XSL file -OUT outfile</code>
  274. </p>
  275. <p>
  276. Note that there are some subtle differences between the FOP and Xalan command-lines.
  277. </p>
  278. </section>
  279. <section id="memory">
  280. <title>Memory Usage</title>
  281. <p>
  282. FOP can consume quite a bit of memory, even though this has been continually improved.
  283. This is partly inherent to the formatting process and partly caused by implementation choices.
  284. All FO processors currently on the market have memory problems with certain layouts.
  285. </p>
  286. <p>
  287. If you are running out of memory when using FOP, here are some ideas that may help:
  288. </p>
  289. <ul>
  290. <li>
  291. Increase memory available to the JVM. See
  292. <a href="http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/java.html">the -Xmx option</a>
  293. for more information.
  294. <warning>
  295. It is usually unwise to increase the memory allocated to the JVM beyond the amount of
  296. physical RAM, as this will generally cause significantly slower performance.
  297. </warning>
  298. </li>
  299. <li>
  300. Avoid forward references.
  301. Forward references are references to some later part of a document.
  302. Examples include page number citations which refer to pages which follow the citation,
  303. tables of contents at the beginning of a document, and page numbering schemes that
  304. include the total number of pages in the document
  305. (<a href="../faq.html#pagenum">"page N of TOTAL"</a>).
  306. Forward references cause all subsequent pages to be held in memory until the reference
  307. can be resolved, i.e. until the page with the referenced element is encountered.
  308. Forward references may be required by the task, but if you are getting a memory
  309. overflow, at least consider the possibility of eliminating them.
  310. A table of contents could be replaced by PDF bookmarks instead or moved to the end of
  311. the document (reshuffle the paper could after printing).
  312. </li>
  313. <li>
  314. Avoid large images, especially if they are scaled down.
  315. If they need to be scaled, scale them in another application upstream from FOP.
  316. For many image formats, memory consumption is driven mainly by the size of the image
  317. file itself, not its dimensions (width*height), so increasing the compression rate
  318. may help.
  319. </li>
  320. <li>
  321. Use multiple page sequences.
  322. FOP starts rendering after the end of a page sequence is encountered.
  323. While the actual rendering is done page-by-page, some additional memory is
  324. freed after the page sequence has been rendered.
  325. This can be substantial if the page sequence contains lots of FO elements.
  326. </li>
  327. </ul>
  328. </section>
  329. <section id="problems">
  330. <title>Problems</title>
  331. <p>If you have problems running FOP, please see the <a href="../gethelp.html">"How to get Help" page</a>.</p>
  332. </section>
  333. </body>
  334. </document>