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

Understanding PDF forms – FDF structure

1 min read

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

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.

IDRsolutions develop a Java PDF library, a PDF forms to HTML5 converter, a PDF to HTML5 or SVG converter and a Java Image Library that doubles as an ImageIO replacement. On the blog our team post about anything interesting they learn about.

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

Resaving Acrobat Forms in the Browser

With the removal of Acrobat Reader support in Chrome and other browsers, we have seen a big increase in the number of clients asking...
Mark Stephens
1 min read

Leave a Reply

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

IDRsolutions Ltd 2020. All rights reserved.