Understanding PDF forms – FDF structure

This is the fourth part of the Understanding the PDF forms series, and in this article we start to explore the FDF Forms Data Format.

If you missed the first in the series please read it here http://blog.idrsolutions.com/2011/05/understanding-pdf-forms-introduction-to-fdf-forms/

Before we get into the nitty gritty, I thought I would go over the structure of the FDF forms, and try to get you thinking in an FDF way.

Go back to our ‘Fields‘ tag within ‘AcroForms’ in our PDF.
From this point we can have either:
a PDF reference or field defined directly,
multiple  fields defined directly,
or Pdf references that define more pdf references within it, (This is called a ‘parent’ form)

So we have a system that allows lots of fields, and these fields can have one or multipul fields within them, ie Kids. There will be a finite number of forms defined in the structure, there should not be any looping.

Why do we have parents and Kids?
This is because the forms allow inheritance, which means you can group similar fields together and omit generic details from the Kid fields, meaning less space is taken up within the PDF document.

An example may help clarify things:
if we have a parent with Reference 45 0 R, that has a value of FT – Ch, and Kids defined as 51 0 R, 52 0 R.
This means that there are 2 ‘end’ fields, which are 51 0 R and 52 0 R, but both of these inherit the value FT making them both choice fields.

One large thing to NOTE is that, if a child field defines a value of FT then this value overrides the parent value for that field and any descendants. It does not alter any siblings to that field. ie if 52 0 R defines FT as Btn then it is a button, but 51 0 R is still a Choice field as it uses the value defined in the parent still.

In my next article we will continue to explore more in FDF Forms. Stay tuned…

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

Related Posts:

The following two tabs change content below.
Chris developed much of the Forms handling code and also the hooks for the XFA.
Chris

About Chris Wade

Chris developed much of the Forms handling code and also the hooks for the XFA.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>