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

Understanding PDF forms – AcroForms structure

1 min read

acroforms forms pdf

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

If you missed the first in the series, why not check out first our Introduction to AcroForms.acroforms forms pdf

Before we get into the nitty-gritty, I thought I would go over the structure of AcroForms, and try to get you thinking in an AcroForms 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 multiple 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 AcroForms. 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.

Do you need to solve any of these problems?

Use PDF Forms in the Web Browser
Integrate PDF Forms into Web Apps
Convert PDF forms to HTML5
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 *

IDRsolutions Ltd 2022. All rights reserved.