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

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