This link has been bookmarked by 1 people . It was first bookmarked on 03 Oct 2008, by Philip Guth.
-
03 Oct 08
-
It takes an XML document containing some shipping information detailing items purchased by a customer and generates a corresponding invoice document in PDF format suitable for printing. The assembly highlights how easy it is to write custom assembly components that implement third party libraries – in this case Apache FOP is used to help generate the PDF output.
-
- http-in transport – listens for incoming requests delivered to http://localhost:8080/ccx/FOPAssembly.
- xslt step component – transforms incoming XML documents to XSL-FO using an XSL script.
- custom step component – custom Java implementation of Apache FOP that processes XSL-FO to generate PDF output
-
The PDF generation is performed within the assembly using Apache FOP (Formatting Objects Processor). FOP is basically a processor that takes XSL-FO (XSL formatting objects) documents and converts them to PDF and other printable outputs. In order to get the original XML document into XSL-FO it needs to be transformed. This is done using an XSLT script run against the XML using an XSLT processor.
-
Since XML on its own does not contain any information relating to its presentation on paper it needs some additional format to help it do this (forget about CSS for now as it is really only concerned with rendering XML within a browser only). This is where XSL-FO comes into the picture. It describes what the printed pages look like and how the XML data should be presented.
-
XSLT is another part of the set of the XSL toolset and is used as a method of changing the structure of XML documents. Transforming XML from one format to another requires an XSLT script that defines what parts of the XML are transformed and into what. In addition to the script, performing the actual transformation requires an XSLT processing engine.
-
Once you've got your XSL-FO format, there's still one last step to go before it can become a readable document. This last step requires a "FO processor". This determines how to position the text within the boundaries described by the XSL-FO document. One of the most widely used open source FO processors is Apache FOP. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to PDF.
-
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.