In this example we will generate a PDF document containing text received in the HTTP request parameters.
To run the example, submit this form, after changing the provided text if you want to:
If your browser has problems with PDF coming out of a form submit use this link instead.
The FOPSerializer requires a document in the XSL-FO vocabulary for input, and converts this to PDF, handling fonts, page layout, etc.
Our sitemap will then apply an XSL transform to the output of the RequestGenerator to convert it to XSL-FO, using request parameter values provided by the generator.
Errors in the XSL-FO document can happen when implementing such a transform, and to make debugging easier we use a view in the sitemap, to access the intermediate document before it is processed by the FOPSerializer.
Here are the view and pipeline definitions:
These definitions allow the intermediate XSL-FO document to be retrieved by adding
the
cocoon-view=xsl-fo parameter at the end of the URL, for example:
../pdf-example/pdf-example.pdf?title=....&cocoon-view=xsl-fo
This transformation converts the RequestGenerator output in XSL-FO, inserting the value of the text and title request parameters in the output document: