Comments? Feedback?

This wiki does not yet support public comments (a limitation of Google Sites), so we encourage you to post your comments either:

On Twitter by responding to @orbeon.

On our community mailing list: subscribe sending an email to ops-users-subscribe@ow2.org (content of subject/body doesn't matter), you'll get a response with the email to use to send your message to the community mailing list.

Recent site activity

Generate a PDF from a form


The problem

You have a form you wrote in XForms "by hand" (i.e. not using Form Builder), and would like to provide a generate PDF functionality, like the one provided by Form Runner.

The solution

This solution will most likely give you a head start, but this isn't a one-size-fits-all solution, and you most likely will need to customize it to your needs. So instead of coding this by hand, we recommend you use Form Runner. This being said, you will implement this in a pipeline which runs the following steps:
  1. In XSLT, you change your form to use the noscript mode, the static readonly appearance for fields (so the PDF shows the value of, say, an input field, rather than the input field itself), and make all the nodes in your instance readonly for the static readonly mode to kick in.
  2. Running the XForms engine, which produces XHTML.
  3. Do some cleanup on the XHTML.
  4. In a last step, run the XHTML to PDF processor.

Run it an get the source

Download xhtml-to-pdf.zip, and uncompress it to resources/apps/xhtml-to-pdf. You can view the form, implemented in form.xhtml, by going to /xhtml-to-pdf/form with your browser. You will see something like:


Then with your browser go to /xhtml-to-pdf/pdf, which runs the pdf.xpl pipeline described earlier. This will produce a PDF, which when opened looks like:


Č
ċ
ď
Alessandro Vernet,
Feb 25, 2011 11:46 AM