Understanding PDF Forms – Introduction To XFA Forms

This is the third part of the Understanding the PDF forms series, and in this article I aim to introduce you to XFA forms, the XML Forms Architecture.

So how do you find XFA forms in a PDF?
As with the FDF format you will find a tag called ‘AcroForms’ within this tag there are others, one of which we found last time as ‘Fields’ which define the FDF forms, also within the AcroForms tag you may be able to find an ‘XFA’ tag. Don’t worry if you cant that just means you don’t have any XFA forms in that PDF Document.
If you do then you have found the XFA forms inside your PDF, Congratulations thats the easier bit, now have a look whats inside it…

Do you like what you see?
If so then your a bit of a specialist, and probably do not need to read further. If it doesn’t make sense then continue reading.

So what are all the parts to an XFA form?
Well it is a set of XML documents:

  • preamble (which can be ignored)
  • postamble (which again can be ignore)
  • config (which is defined to have some permissions in, and may have some in newer versions but we have found that ignoring this really doesn’t affect things much at all)
  • template (the most useful Document out of them all, it details everything about the appearance of the XFA fields)
  • datasets (which hold various values to the fields defined in the template Document, not all fields will have values defined here)
  • – there may be other documents defined here but as yet we have not found examples of any usages that alter the XFA forms appearance or use, though I am sure there will be some in the future, with the XFA architecture ever improving and developing.

    As you look through the ‘template’ XML Document, you will see objects within object, there are a lot of objects that can be used including PageSets (which define the page dimentions) and then, Buttons (which define a Button field).
    The structure that you read the Document in is vital to aloccating the field dimentions, values, attributes, actions etc to the correct fields. This structure is the classic object orientated style, and lends itself the languages like java for working with.

    We will be exploring more into the XFA forms at a later stage, and when we have written it we will link it in here.

    In my next article I will start exploring the FDF Forms Format. Stay tuned…

    This article is part of the Understanding the PDF forms series. You can see all the articles so far in the Understanding PDF forms series.


    Categorized as XML

    By Mark Stephens

    Mark Stephens runs IDRsolutions, developing the JPedal PDF library in Java, and shares his thoughts on Java, PDF, the Business of Software and Mediaeval History at http://www.jpedal.org/PDFblog .