How to use a PDF transformer (Apache FOP) for Mule ESB 3.2
Introduction
The PDF transformer for Mule ESB uses Apache FOP for converting XML files to
PDF using XSL-FO. We have created a package that contains all you need. You are
free to use the transformer, only the J4L extensions require a specific license.
Requirements
This documentation, examples and component have been written and tested with Mule
ESB 3.2
How to run a simple test, step by step
We assume you are using Eclipse based Mule IDE, if that is not your case, you
can install is as described here.
You proceed like this:
- In eclipse select File -> new -> project ... and select
Mule Project
- Enter the data like this
- click finish and the project will be created
- create a "conf" folder, download this mule-config.xml
and place
it there
- now download this file which contains all required
third party libraries.
Unzip the file and place them somewhere on your computer
- click on your project and select properties from the context menu,
and use the "Add external JARs.." button to add all the Jars you
have just downloaded
Now you are ready to test the XML to PDF conversion The mule-config.xml file you have downloaded will expect the following
directories to exists so proceed like this
- create c:\tmp\input
- create c:\tmp\output
- download the file departmentEmployees.fo
and copy it to c:\tmp
- download the file departmentEmployees.xml
and copy it to c:\tmp\input
Now you start your project, right click on mule-config.xml and select:
Now you should see the input file from c:\tmp\input being moved to
c:\tmp\output as a PDF file.
J4L Extensions
The additional features provided by J4L are:
- Barcodes and charts. The usage as described here does not change, barcodes
and charts can be added to the XSL-FO file using the J4L FO Designer.
- PDF interactive forms. The usage as described here does not change, form
fields can be added to the XSL-FO file using the J4L FO Designer.
- Adding digital signatures to PDF files. For this feature you have to
provide the following additional properties in the customer transform:
P12File, P12Psw and Signature. The P12 file contains the certificate and
private key used for the signature, the P12Psw is the password for the p12
file and the Signature property must be set to "true". This is an
example:
< custom-transformer
name="XMLToPDF"
class="com.java4less.mule.FOPTransformer">
< spring:property
name="templateFile"
value="c:/tmp/departmentEmployees.fo"/>
<spring:property
name="P12File"
value="Jon.p12"/>
<spring:property
name="P12Psw"
value="test"/>
<spring:property
name="Signature"
value="true"/>
</custom-transformer>
|