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

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