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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <?xml version="1.0" encoding="UTF-8" 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 &gt;=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. -version print FOP version and exit
  112. -d debug mode
  113. -x dump configuration settings
  114. -q quiet mode
  115. -c cfg.xml use additional configuration file cfg.xml
  116. -l lang the language to use for user information
  117. -nocs disable complex script features
  118. -r relaxed/less strict validation (where available)
  119. -dpi xxx target resolution in dots per inch (dpi) where xxx is a number
  120. -s for area tree XML, down to block areas only
  121. -v run in verbose mode (currently simply print FOP version and continue)
  122. -o [password] PDF file will be encrypted with option owner password
  123. -u [password] PDF file will be encrypted with option user password
  124. -noprint PDF file will be encrypted without printing permission
  125. -nocopy PDF file will be encrypted without copy content permission
  126. -noedit PDF file will be encrypted without edit content permission
  127. -noannotations PDF file will be encrypted without edit annotation permission
  128. -nofillinforms PDF file will be encrypted without fill in forms permission
  129. -noaccesscontent PDF file will be encrypted without extract text and graphics permission
  130. -noassembledoc PDF file will be encrypted without assemble the document permission
  131. -noprinthq PDF file will be encrypted without print high quality permission
  132. -a enables accessibility features (Tagged PDF etc., default off)
  133. -pdfprofile prof PDF file will be generated with the specified profile
  134. (Examples for prof: PDF/A-1b or PDF/X-3:2003)
  135. -conserve enable memory-conservation policy (trades memory-consumption for disk I/O)
  136. (Note: currently only influences whether the area tree is serialized.)
  137. -cache specifies a file/directory path location
  138. -flush flushes the current font cache file
  139. [INPUT]
  140. infile xsl:fo input file (the same as the next)
  141. (use '-' for infile to pipe input from stdin)
  142. -fo infile xsl:fo input file
  143. -xml infile xml input file, must be used together with -xsl
  144. -atin infile area tree input file
  145. -ifin infile intermediate format input file
  146. -imagein infile image input file (piping through stdin not supported)
  147. -xsl stylesheet xslt stylesheet
  148. -param name value <value> to use for parameter <name> in xslt stylesheet
  149. (repeat '-param name value' for each parameter)
  150. -catalog use catalog resolver for input XML and XSLT files
  151. [OUTPUT]
  152. outfile input will be rendered as PDF into outfile
  153. (use '-' for outfile to pipe output to stdout)
  154. -pdf outfile input will be rendered as PDF (outfile req'd)
  155. -pdfa1b outfile input will be rendered as PDF/A-1b compliant PDF
  156. (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b")
  157. -awt input will be displayed on screen
  158. -rtf outfile input will be rendered as RTF (outfile req'd)
  159. -pcl outfile input will be rendered as PCL (outfile req'd)
  160. -ps outfile input will be rendered as PostScript (outfile req'd)
  161. -afp outfile input will be rendered as AFP (outfile req'd)
  162. -tiff outfile input will be rendered as TIFF (outfile req'd)
  163. -png outfile input will be rendered as PNG (outfile req'd)
  164. -txt outfile input will be rendered as plain text (outfile req'd)
  165. -at [mime] out representation of area tree as XML (outfile req'd)
  166. specify optional mime output to allow the AT to be converted
  167. to final format later
  168. -if [mime] out representation of document in intermediate format XML (outfile req'd)
  169. specify optional mime output to allow the IF to be converted
  170. to final format later
  171. -print input file will be rendered and sent to the printer
  172. see options with "-print help"
  173. -out mime outfile input will be rendered using the given MIME type
  174. (outfile req'd) Example: "-out application/pdf D:\out.pdf"
  175. (Tip: "-out list" prints the list of supported MIME types)
  176. -svg outfile input will be rendered as an SVG slides file (outfile req'd)
  177. Experimental feature - requires additional fop-sandbox.jar.
  178. -foout outfile input will only be XSL transformed. The intermediate
  179. XSL-FO file is saved and no rendering is performed.
  180. (Only available if you use -xml and -xsl parameters)
  181. [Examples]
  182. fop foo.fo foo.pdf
  183. fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)
  184. fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
  185. fop -xml foo.xml -xsl foo.xsl -foout foo.fo
  186. fop -xml - -xsl foo.xsl -pdf -
  187. fop foo.fo -mif foo.mif
  188. fop foo.fo -rtf foo.rtf
  189. fop foo.fo -print
  190. fop foo.fo -awt]]></source>
  191. <p>
  192. PDF encryption is only available if FOP was compiled with encryption support
  193. <strong>and</strong> if compatible encryption support is available at run time.
  194. Currently, only the JCE is supported. Check the <a href="pdfencryption.html">Details</a>.
  195. </p>
  196. </section>
  197. <section id="your-own-script">
  198. <title>Writing your own script</title>
  199. <p>FOP's entry point for your own scripts is the class
  200. <code>org.apache.fop.cli.Main</code>. The general pattern for the
  201. command line is: <code>java -classpath &lt;CLASSPATH&gt;
  202. org.apache.fop.cli.Main &lt;arguments&gt;</code>. The arguments
  203. consist of the options and infile and outfile specifications
  204. as shown above for the standard scripts. You may wish to review
  205. the standard scripts to make sure that
  206. you get your environment properly configured.
  207. </p>
  208. </section>
  209. <section id="jar-option">
  210. <title>Running with java's <code>-jar</code> option</title>
  211. <p>
  212. As an alternative to the start scripts you can run <code>java
  213. -jar path/to/build/fop.jar &lt;arguments&gt;</code>, relying on
  214. FOP to build the classpath for running FOP dynamically, see <a
  215. href="#dynamical-classpath">below</a>. If you use hyphenation,
  216. you must put <code>fop-hyph.jar</code> in the <code>lib</code>
  217. directory.
  218. </p>
  219. <p>You can also run <code>java -jar path/to/fop.jar
  220. &lt;arguments&gt;</code>, relying on the <code>Class-Path</code>
  221. entry in the manifest file. This works if you put
  222. <code>fop.jar</code> and all jar files from the <code>lib</code>
  223. directory in a single directory. If you use hyphenation, you
  224. must also put <code>fop-hyph.jar</code> in that directory.</p>
  225. <p>In both cases the arguments consist of the options and
  226. infile and outfile specifications as shown above for the
  227. standard scripts.</p>
  228. </section>
  229. <section id="dynamical-classpath">
  230. <title>FOP's dynamical classpath construction</title>
  231. <p>If FOP is started without a proper classpath, it tries to
  232. add its dependencies dynamically. If the system property
  233. <code>fop.home</code> contains the name of a directory, then
  234. FOP uses that directory as the base directory for its
  235. search. Otherwise the current working directory is the base
  236. directory. If the base directory is called <code>build</code>,
  237. then its parent directory becomes the base directory.</p>
  238. <p>FOP expects to find <code>fop.jar</code> in the
  239. <code>build</code> subdirectory of the base directory, and
  240. adds it to the classpath. Subsequently FOP adds all
  241. <code>jar</code> files in the lib directory to the
  242. classpath. The lib directory is either the <code>lib</code>
  243. subdirectory of the base directory, or, if that does not
  244. exist, the base directory itself.</p>
  245. <p>If the system property <code>fop.optional.lib</code>
  246. contains the name of a directory, then all <code>jar</code>
  247. files in that directory are also added to the classpath. See
  248. the methods <code>getJARList</code> and
  249. <code>checkDependencies</code> in
  250. <code>org.apache.fop.cli.Main</code>.</p>
  251. </section>
  252. </section>
  253. <section id="check-input">
  254. <title>Using Xalan to Check XSL-FO Input</title>
  255. <p>
  256. FOP sessions that use -xml and -xsl input instead of -fo input are actually
  257. controlling two distinct conversions: Tranforming XML to XSL-FO, then formatting
  258. the XSL-FO to PDF (or another FOP output format).
  259. Although FOP controls both of these processes, the first is included merely as
  260. a convenience and for performance reasons.
  261. Only the second is part of FOP's core processing.
  262. If a user has a problem running FOP, it is important to determine which of these
  263. two processes is causing the problem.
  264. If the problem is in the first process, the user's stylesheet is likely the cause.
  265. The FOP development team does not have resources to help with stylesheet issues,
  266. although we have included links to some useful
  267. <a href="../resources.html#specs">Specifications</a> and
  268. <a href="../resources.html#articles">Books/Articles</a>.
  269. If the problem is in the second process, FOP may have a bug or an unimplemented
  270. feature that does require attention from the FOP development team.
  271. </p>
  272. <note>The user is always responsible to provide correct XSL-FO code to FOP.</note>
  273. <p>
  274. In the case of using -xml and -xsl input, although the user is responsible for
  275. the XSL-FO code that is FOP's input, it is not visible to the user. To make the
  276. intermediate FO file visible, the FOP distribution includes the "-foout" option
  277. which causes FOP to run only the first (transformation) step, and write the
  278. results to a file. (See also the Xalan command-line below)
  279. </p>
  280. <note>
  281. When asking for help on the FOP mailing lists, <em>never</em> attach XML and
  282. XSL to illustrate the issue. Always run the XSLT step (-foout) and send the
  283. resulting XSL-FO file instead. Of course, be sure that the XSL-FO file is
  284. correct before sending it.
  285. </note>
  286. <p>
  287. The -foout option works the same way as if you would call the
  288. <a href="http://xml.apache.org/xalan-j/commandline.html">Xalan command-line</a>:
  289. </p>
  290. <p>
  291. <code>java org.apache.xalan.xslt.Process -IN xmlfile -XSL file -OUT outfile</code>
  292. </p>
  293. <p>
  294. Note that there are some subtle differences between the FOP and Xalan command-lines.
  295. </p>
  296. </section>
  297. <section id="memory">
  298. <title>Memory Usage</title>
  299. <p>
  300. FOP can consume quite a bit of memory, even though this has been continually improved.
  301. This is partly inherent to the formatting process and partly caused by implementation choices.
  302. All FO processors currently on the market have memory problems with certain layouts.
  303. </p>
  304. <p>
  305. If you are running out of memory when using FOP, here are some ideas that may help:
  306. </p>
  307. <ul>
  308. <li>
  309. Increase memory available to the JVM. See
  310. <a href="http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/java.html">the -Xmx option</a>
  311. for more information.
  312. <warning>
  313. It is usually unwise to increase the memory allocated to the JVM beyond the amount of
  314. physical RAM, as this will generally cause significantly slower performance.
  315. </warning>
  316. </li>
  317. <li>
  318. Avoid forward references.
  319. Forward references are references to some later part of a document.
  320. Examples include page number citations which refer to pages which follow the citation,
  321. tables of contents at the beginning of a document, and page numbering schemes that
  322. include the total number of pages in the document
  323. (<a href="../faq.html#pagenum">"page N of TOTAL"</a>).
  324. Forward references cause all subsequent pages to be held in memory until the reference
  325. can be resolved, i.e. until the page with the referenced element is encountered.
  326. Forward references may be required by the task, but if you are getting a memory
  327. overflow, at least consider the possibility of eliminating them.
  328. A table of contents could be replaced by PDF bookmarks instead or moved to the end of
  329. the document (reshuffle the paper could after printing).
  330. </li>
  331. <li>
  332. Avoid large images, especially if they are scaled down.
  333. If they need to be scaled, scale them in another application upstream from FOP.
  334. For many image formats, memory consumption is driven mainly by the size of the image
  335. file itself, not its dimensions (width*height), so increasing the compression rate
  336. may help.
  337. </li>
  338. <li>
  339. Use multiple page sequences.
  340. FOP starts rendering after the end of a page sequence is encountered.
  341. While the actual rendering is done page-by-page, some additional memory is
  342. freed after the page sequence has been rendered.
  343. This can be substantial if the page sequence contains lots of FO elements.
  344. </li>
  345. </ul>
  346. </section>
  347. <section id="problems">
  348. <title>Problems</title>
  349. <p>If you have problems running FOP, please see the <a href="../gethelp.html">"How to get Help" page</a>.</p>
  350. </section>
  351. </body>
  352. </document>