PDF: making text fields grow to accommodate text

  • Note: 2-11-15 I updated this post today, noting an important difference between the 2 samples.
  • Note: 5-5-14 I updated this document today, adding another sample below.
  • Note: 1-25-11 I updated this document today, adding another quote from the original article and a quote about saving as a dynamic PDF.

Creating a dynamically expanding pdf is something that I’ve tried several times over the last two years with no success until now.
Google results are littered with the sad stories of others attempting this and being shut dow n.
I even contacted the instructor of the advanced Acrobat Pro/Live Cycle Designer course, to no avail.

The goal is to create a form that includes expandable text areas and when the they expand the rest of the content adjusts to accommodate them. Ideally these fields would even allow content to break across pages.

Along the way I would frequently find encouraging check boxes or form properties like “expand vertically” or “dynamic” vs. static pdf; nothing quite worked.
The check the box to allow text to vertically expand by itself is great, unless you want to print the form… the content that goes past the text box, is hidden and a plus sign denotes that something is there… Pretty much useless…

Last month I found an article by Stefan Cameron (forms.stefcameron.com) that described some script that allowed fields to grow horizontally to a max width. It seemed reasonable enough and I was impressed, but when I tried to apply the code to a vertical growth it merely expanded over the top of the content below it.
At that point I started creating code that capture the position and height of the previous element and move everything down the page when ever a text field expanded. That code didn’t go anywhere fast and it seemed like it was going to be a nightmare to find all the necessary functions and tags to achieve it.
I’m glad I abandoned that project.
Adobe provides examples of inserting new fields in documents and that the adjacent content in those documents moved out of the way as the fields were inserted. So I knew there was an internal function that allowed for some document flow, but what was it?
This week I was inclined to try again and upon revisiting Stefan Cameron’s site I found something that caught my eye: flowable layout. It seemed possible that we could achieve our goal.