FOP. The FOP distribution includes all libraries that you will need to run a basic FOP installation. These can be found in the xml-fop/lib directory. These libraries include the following:
Apache Xerces-J for XML parsing. You can use other XML parsers which support SAX and DOM.
Apache Xalan, an XSLT processor.
Apache Batik, an SVG library.
Optional Libraries
Instructions
Basic FOP installation consists of first unzipping the .gz file that is the distribution medium, then unarchiving the resulting .tar file in a directory/folder that is convenient on your system. Please consult your operating system documentation or Zip application software documentation for instructions specific to your site.
Problems
Some Mac OSX users have experienced filename truncation problems using Stuffit to unzip and unarchive their distribution media. This is a legacy of older Mac operating systems, which had a 31-character pathname limit. Several Mac OSX users have recommended that Mac OSX users use the shell command tar -xzf instead.
Starting FOP as a standalone application
Review the batch file fop.bat or the shell script fop.sh to see how FOP is invoked.
The standard scripts for starting FOP require that the environment variable JAVA_HOME be set to a path pointing to the appropriate Java installation on your system. Macintosh OSX includes a Java environment as part of its distribution. We are told by Mac OSX users that the path to use in this case is /Library/Java/Home. Caveat: We suspect that, as Apple releases new Java environments and as FOP upgrades the minimum Java requirements, the two will inevitably not match on some systems. Please see Java on Mac OSX FAQ for information as it becomes available.
PDF encryption is only available if FOP was compiled with encryption support and if compatible encryption support is availabe at run time. Currently, only the JCE is supported. Check the Details.
Running Xalan
The FOP distribution provicdes a Xalan.bat and a Xalan.sh
script for conveniently running an XSL transformation without
formatting. This can be useful for tracking down problems
introduced during transformation and for preparing FO files
for all kinds of purposes, including for inquiring help on the
mailing lists.
The scripts are invoked the same way Xalan is, in short:
xalan -in xmlfile -xsl file -out outfile
Note that there are subtle differences to the FOP command line.
Memory Usage
FOP can consume quite a bit of memory, even though this has been continually improved.
This is partly inherent to the formatting process and partly caused by implementation choices.
All FO processors currently on the market have memory problems with certain layouts.
If you are running out of memory when using FOP, here are some ideas that may help:
Increase memory available to the JVM. See the -Xmx option for more information.
(Warning: It is usually unwise to increase the memory allocated to the JVM beyond the amount of physical RAM, as this will generally cause significantly slower performance.)
Avoid forward references.
Forward references are references to some later part of a document.
Examples include page number citations which refer to pages which follow the citation, tables of contents at the beginning of a document, and page numbering schemes that include the total number of pages in the document ("page N of TOTAL").
Forward references cause all subsequent pages to be held in memory until the reference can be resolved, i.e. until the page with the referenced element is encountered.
Forward references may be required by the task, but if you are getting a memory overflow, at least consider the possibility of eliminating them.
A table of contents might be eliminated, relying on PDF bookmarks instead.
Or it might be moved to the end of the document without dimishing its value very much.
Or, in some circumstances, the paper could even be reshuffled after printing.
Avoid large images, especially if they are scaled down.
If they need to be scaled, scale them in another application upstream from FOP.
For many image formats, memory consumption is driven mainly by the size of the image file itself, not its dimensions (width*height), so increasing the compression rate may help.
Use multiple page sequences.
FOP starts rendering after the end of a page sequence is encountered.
While the actual rendering is done page-by-page, some additional memory allocated for other purposes could be freed after the page sequence has been rendered.
Break down large tables.
If you don't use table headers and footers, just start a new table every N rows.
With headers and footers, consider integrating them as normal table rows, or, if they are used at page breaks, try to put the information into static content.
You can then use markers to change them.
There are currently some bugs which cause FOP to go into a nonterminating loop, which will also often result in a memory overflow.
A characteristic symptom is continuous box overflows in the log.
Most of these loops are triggered by elements that do not fit in the available space, such as big images or an improperly specified width in nested block elements.
The only workaround is to locate such problems and correct them.
One of FOP's stated design goals is to be able to process input of arbitrary size.
Addressing this goal is one of the prime motivations behind the FOP Redesign.
Problems
If you have problems running FOP, please have a look at the "How to get Help" page.