Apache » Cocoon »

  Cocoon FOP
      1.0
   homepage

Cocoon FOP 1.0

Basic usage

Basic usage

Declaration of the the needed serializer(s)

In the <map:serializers> section of the section, add this :

  • for pdf generation :
<map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer" 
    mime-type="application/pdf" 
    logger="sitemap.serializer.fo2pdf">
  • for pcl generation :
<map:serializer name="fo2pcl" src="org.apache.cocoon.serialization.PCLSerializer" 
    mime-type="application/vnd.hp-PCL" 
    logger="sitemap.serializer.fo2pcl">
  • for ps generation :
<map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer" 
    mime-type="application/ps" 
    logger="sitemap.serializer.fo2ps">

Serializers usage in the pipeline

In the pipelines, just add this for example :
<map:match pattern="hello.pdf">
  <map:generate src="hello.fo" type="file"/>
  <map:serialize type="fo2pdf"/>
</map:match>
You will need the sample hello.fo file to be located in the same directory as the sitemap.xmap

Java options

When Cocoon is running on a headless envirionment, the java runtime must be notified using the command line option "-Djava.awt.headless=true"

This can be easilly done when running Cocoon inside apache Tomcat : just set the CALALINA_OPTS environment variable.

export CATALINA_OPTS="-Djava.awt.headless=true"
Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).