Friday 1 February 2013

Ant Task for FOP

There is an ant task for FOP

For FOP 0.95 see http://xmlgraphics.apache.org/fop/0.95/anttask.html

For FOP 1.0 see http://xmlgraphics.apache.org/fop/1.0/anttask.html

for full details


<property name="fop.home" value="....path to your FOP HOME directory..."/>

<taskdef name="fop"
         classname="org.apache.fop.tools.anttasks.Fop">
  <classpath>
    <fileset dir="${fop.home}/lib">
      <include name="*.jar"/>
    </fileset>
    <fileset dir="${fop.home}/build">
      <include name="fop.jar"/>
      <include name="fop-hyph.jar" />
    </fileset>
  </classpath>
</taskdef>



<target name="generate-pdf" description="Generates a single PDF file">
   <fop format="application/pdf"
        fofile="c:\working\foDirectory\foDocument.fo"
        outfile="c:\working\pdfDirectory\pdfDocument.pdf" />
</target>

<target name="generate-multiple-pdfs"
        description="Generates multiple PDF files">
   <fop format="application/pdf"
        outdir="${build.dir}" messagelevel="debug">
        <fileset dir="${fo.examples.dir}">
           <include name="*.fo"/>
        </fileset>
   </fop>
</target>