Enabling the PDF Generator

The PDF Generator component is part of Infopark Rails Connector up to version Proceed as follows to activate the PDF generator.

Installing Apache FOP

The PDF generator makes use of Apache FOP (Formatting Objects Processor), to create PDF files.

  1. Change to the directory where you wish to install Apache FOP, for example to /opt/local:

    $ cd /opt/local
  2. Now, download Apache FOP, version 0.94, from the official website:

    $ wget http://archive.apache.org/dist/xmlgraphics/fop/binaries/fop-0.94-bin-jdk1.4.zip

    The PDF generator is not compatible with newer versions of Apache FOP.

  3. Unpack the downloaded archive:

    $ unzip fop-0.94-bin-jdk1.4.zip
    $ rm fop-0.94-bin-jdk1.4.zip
  4. Change to the installation directory of the FOP and make the start script executable:

    $ cd fop-0.94
    $ chmod 755 fop
  5. With large PDF files, Apache FOP requires more memory than it assigns to itself initially. To prevent a lack of memory, we recommend to increase the amount of RAM available to the FOP. To do this, open the file fop-0.94/fop and change the line

    fop_exec_command="exec \"$JAVACMD\" $LOGCHOICE $LOGLEVEL -classpath (...)

    to the following:

    fop_exec_command="exec \"$JAVACMD\" -Xmx500M $LOGCHOICE $LOGLEVEL -classpath (...)
  6. Add the path of the FOP's installation directory to your search paths in the PATH environment variable.

Installing Tidy

The PDF Generator uses Tidy to clean up invalid XML. Therefore, please install Tidy first. The documentation for Tidy can be found on the official website, http://tidy.sourceforge.net.

The Tidy gem is also required. However, this gem has already been installed since the Rails Connector depends on it.

Activating the PDF Generator

To activate the PDF generator, open the file RAILS_ROOT/config/initializers/rails_connector.rb and remove the comment character from the line indicated below:

# :pdf_generator