This component creates PDF files using XML and XSL Style sheet (or XSL-FO) as input.
It uses Apache FOP library to create PDF files.
Configuration and Testing
Properties can be configured in the Configuration Property Sheet (CPS) of the component. The properties available are explained below.
Component Configuration
Figure 1: Component Configuration panel
Attributes
XML2PDF Configuration
Input and Output details of XML2PDF transformation have to be provided here. Click the ellipsis button against this property to configure the same in the dialog box.
Figure 2: XML2PDF Configuration dialog box
Create PDF Using
The input to the component can be configured here. The component accepts data in 2 formats as follows:
- XML and XSL
The path of the XSL style sheet has to be specified in the Custom Property Sheet and XML data has to be sent as an input to the component through its input port - XSL-FO
XSL-FO has to be sent as an input to the component through its input port.
XSL File Path
The path of the XSL Style Sheet has to be specified here. This property has a file filter and only the files with .xsl extension will be shown in the file chooser.
Output Directory
The output directory in which PDF files have to be generated should be specified here.
Output File Name
The name for the output file that has to be created. By default this name is used for the output file. If a different file name has to be used, then a JMS Property "filename" has to be set on the input message to the component.
User Configuration file
File containing custom configuration.
Named Configuration
A specific configuration can be configured as Named Configuration to use it across multiple instances.
Please refer to Save Named Configuration section in the Common Configurations page to know how to save a named configuration.
Error Handling Configuration
The remedial actions to be taken when a particular error occurs can be configured here.
Click the ellipsis button against this property to configure Error Handling properties for different types of Errors.
Please refer Error Handling section in Common Configurations page for detailed information.
Testing
Sample Input and Output
XML and XSL
Configure XML2PDF component to use XML and XSL as input type as explained in Configuration and Testing section.
Launch the flow and send the sample XML input through Feeder component.
If the PDF creation is successful, the component sends an XML message which contains OutputDirectory, OutputFile and Message elements on to its output.
If there is any error in generating the PDF file, an error message indicating the exceptions will be sent to the component's ON_EXCEPTION port.
Figure 3: Sample Input
Figure 4: Output PDF File Created
XSL –FO
Configure XML2PDF to use XSL-FO as input type. Launch the flow and send the sample XSL-FO input through Feeder component. Also use a different output file name by setting filename JMS property on the Input message.
If the PDF creation is successful, the component sends an XML output message which contains OutputDirectory, OutputFile and Message elements on to its output as shown below.
If there is any error in generating the PDF file, an error message indicating the exceptions will be sent to the component's ON_EXCEPTION port.
Figure 5: Sample Input
Figure 6: Output PDF File