How to use FO Designer with Apache Cocoon
Apache Cocoon is a web development framework which includes a component for
XML to PDF conversion. This is achieved by using the so called "PDF
serializer". This requires you to create a XSL-FO file which describes how
to convert the XML file to PDF.
XSL-FO files created using J4L FO Designer are fully compatible and can be
used in Apache Cocoon PDF serializer.
You can very easily test some of the examples provided with J4L FO designer
in your Apache Cocoon server. For this example we assume you have installed
Cocoon on a tomcat server in the following subdirectory:
We will create a very simple Cocoon application that converts the file examples\employees\departmentEmployees.xml
You must perform the following steps:
- create a directory called
copy these files from the FO designer distribution to the c:\tomcat\webapps\cocoon\pdfsample
create the file c:\tomcat\webapps\cocoon\pdfsample\sitemap.xmap.
This file should contain the following data:
<map:generate src="departmentEmployees.xml" type="file"/>
<map:transform src="departmentEmployees.fo" type="xslt"/>
Start the web server (Tomcat)
Open the following URL in the browser (we assume your server runs on
The browser shows the PDF file.
As you can seen in this example, the file departmentEmployees.fo
which has been designed with J4L FO Designer has been successfully been executed
by Apache Cocoon.