BOOKMARK & SHARE Bookmark and Share
RSS RenderX RSS
The Future of Your Document Is Here
RenderX logo
Contact Us

Download Now!

XEP 4
RenderX offers all our software on a trial basis so that our prospects can easily see why thousands of customers have selected XEP to meet their needs.

Why not download a trial version today and see for yourself!

XEP Connector for Apache Cocoon

Version 2.1

Yuri Furman

Ashot Darbinian


Overview

XEP Connector for Apache Cocoon is a PDF/PostScript serializer for Cocoon 2.1.x, built upon RenderX XEP XSL FO (XSLFO) formatter. It generates PDF or PostScript documents from XSL Formatting Objects instances.

Prerequisites

In order to use XEP Connector for Cocoon, you must install and configure the following components:

Compilation

The connector's source code is in com/renderx/xepx/cocoon/*.java. We use Ant to build and install the serializer, details are in build.xml.

Before compiling, adjust values of the two properties at the top of the file, cocoon.dir and xep.dir. They must point to the Cocoon and XEP installation directories, respectively.

ant make.jar

will build build/XEPSerializer.jar.

Installation

To add the serializer to Cocoon, you must place XEPSerializer.jar into $COCOON_HOME/WEB-INF/lib, along with other libraries necessary to run XEP. Ant will take care of it, use install as the target:

ant install

You should have the rights to write to the directory; in multi-user environments, ask the system administrator to do this step for you.

After installing the files, restart Cocoon

Usage

Configuring PDF and PostScript Serializers

To use XEP Connector for Cocoon, add PDF and PostScript serializers to the global sitemap, replacing XEP_HOME with XEP-4.* installation directory:

<map:components>
	..........
	<map:serializers default="html">       
	<map:serializer mime-type="application/pdf" name="fo2pdf" 
				src="com.renderx.xepx.cocoon.Serializer">
		<parameter name="com.renderx.xep.CONFIG" type="string" 
				value="XEP_HOME/xep.xml"/>
	</map:serializer>
	<map:serializer mime-type="application/postscript" name="fo2ps" 
				src="com.renderx.xepx.cocoon.Serializer">         
		<parameter name="com.renderx.xep.CONFIG" type="string" 
				value="XEP_HOME/xep.xml"/>
	</map:serializer>
	</map:serializers>
	..........
</map:components>

With the serializers above, the following rule will server DocBook files as PDF documents.

<map:pipelines>
	.........
	<map:pipeline>
	...........
	<map:match pattern="**.pdf">         
		<map:generate src="{1}.dbx"/>         
		<map:transform type="xslt"
           src="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>         
		<map:serialize type="fo2pdf"/>       
	</map:match>     
	...........     
	</map:pipeline>   
</map:pipelines>

For general information about serializers, see Cocoon's documentation at http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html

Configuration Example

To ease adoption, we provide a sitemap example as examples/sitemap.xmap. Copy examples/hammer/ from the XEP's distribution into webapp directory of Cocoon, add the example sitemap.xmap there and edit the path to xep.xml, XEP configuration file. Now, fetch hammer/hammer.pdf from the server via HTTP - the serializer will automatically transform hammer.xml and hammer.xsl into PDF and serve it to you.