FOray

FOray Users
Module Users
Developers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Using the FOray Ant Task

Introduction

Ant is a powerful tool for automating builds. FOray can be used from within Ant by using the custom FOray Ant Task.

Define the Custom Ant Task

The first step toward using FOray from within your Ant scripts is to define the custom task within the Ant script. It is generally desirable to define the task in a common target that is accessible to the remainder of the script, such as an "init" target. Defining the task simply tells Ant how to find the FOray Ant task class, and the classes that are needed to run FOray. In the example below, note that your location for ${foray.home} and the classpath may be different.

    <property name="foray.home" location="D:/foray/trunk/foray/"/>
    <taskdef name="foray"
        classname="org.foray.app.ant.FOray">
      <classpath>
        <fileset dir="${foray.home}/build" includes="*.jar"/>
        <fileset dir="${foray.home}/lib" includes="*.jar"/>
      </classpath>
    </taskdef>

Parameters

After defining the task, you can use it within your script. Simply use it like any other Ant task, giving it the parameters that it needs to perform the desired processing.

Parameters specified as attributes

Attribute Description Required
fofile The XSL-FO input file to be rendered Yes
outfile Path to the output file. Yes
format The mime-type of the desired output format. Possible values:
application/pdf
application/postscript
application/vnd.mif
application/rtf
application/vnd.hp-PCL
text/plain
text/xml
No, defaults to application/pdf
userconfig User configuration file (same as the FOray "-c" command line option) No
messagelevel Logging level. Possible values: error, warn, info, verbose, debug No. Default is verbose

Examples

The following example converts a single XSL-FO file to a PDF document:

<target name="generate-pdf" description="Generate a single PDF file">
   <foray format="application/pdf"
        fofile="D:/fo/document.fo"
        outfile="D:/pdf/document.pdf"/>
</target>