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.

After a bit of testing and reading through pages of comments I created two working documents that do indeed expand and flow! The key is to follow all the necessary steps and it can be done! And no scripting was required.
This is seriously exciting!
Here’s the comment that summed it all up: (forms.stefcameron.com/2006/07/24/previewing-as-dynamic-pdf/#comment-83939):

@Craig Lambson,
The key to making the text fields grow to accommodate text is to:
1. Make them multiline (Object palette > Field tab > Allow multiline property).
2. Make them expandable in height (see “Making a Field Expandable” here).
3. Put them in a flowed subform (that is, a subform whose “Object palette > Subform tab > Content property” is set to “Flowed”) that allows page breaks within its content (via the “Object palette > Subform tab > Allow Page Breaks within Content property”).
4. Allow their contents to break across pages (Object palette > Field tab > Allow Page Breaks within Content property).
Note that all subforms that ultimately contain the text fields (i.e. all subform containers up to the root subform which are parents of the text fields) must be flowed and must allow page breaks within their content.
I also address an issue with content that gets cut-off at the bottom of a page in my MAX 2007 Tutorial by placing the content directly inside the root subform which is flowed by definition.

Oh boy, thank goodness for Craig Lambson’s question and Stefan’s concise answer.

To put that in context: you must edit your form in LiveCycle Designer (I’m using V.8). You won’t find those options in Acrobat Pro.

The main article itself is invaluable; it’s a check list for ensuring your dynamic form is indeed dynamic!

1. If you haven’t saved your form, make sure the Preview Type is set to “Interactive” and that the Default File Type for New Forms is set to a dynamic PDF format. You may also want to set the XDP Preview Format to a dynamic PDF format while you’re at it.
2. If you’ve saved your form as a dynamic PDF, make sure the Preview Type is set to “Interactive”.
3. If you’ve saved your form as a static PDF, none of these settings will help you. You must first save your form as a dynamic PDF.
4. If you’ve saved your form as an XDP, make sure the Preview Type is set to “Interactive” and the XDP Preview Format is set to a dynamic PDF format.
5. If you’re tired of running into these problems and want to avoid them in the future, just set your Default File Type for New Forms to a dynamic PDF format.

Here’s my first test document:
FlowableTest.pdf with two comment fields that expand until you grow tired of it! Note: the fields expand after you leave the field.

Screen shot. Here are the empty fields
Screen shot. Here are the empty fields

Screen shot. Here are the fields, one expanded with extra content
Screen shot. Here are the fields, one expanded with extra content

Screen shot. Edit the document in LiveCycle
Edit the document in LiveCycle

Once you’re in edit mode you follow the steps:
The key to making the text fields grow to accommodate text is to:

  1. Make them multiline (Object palette > Field tab > Allow multiline property).
    Make the Text Field Multiline
  2. Make them expandable in height (see “Making a Field Expandable” here).
    Screen shot: Make the Text Field expandable in height
  3. Put them in a flowed subform (that is, a subform whose “Object palette > Subform tab > Content property” is set to “Flowed”) that allows page breaks within its content (via the “Object palette > Subform tab > Allow Page Breaks within Content property”).
    *Note: you can highlight all your objects and use the contextual menu (right click) to ‘Wrap in a subform’.
    Screen shot: Choose the subform and make the layout 'flowable'
  4. Allow their contents to break across pages (Object palette > Field tab > Allow Page Breaks within Content property).
    Screen shot: Allow the Text Field content to 'break across pages'

I have a few other settings that I like too:

Screen shot: Left justify and Vertically Align the content of the Text Field
Screen shot: Left justify and Vertically Align the content of the Text Field

Screen shot: additional settings
Screen shot: Set the width of the field, anchor it: top, left, remove the margins if needed and position the caption with no reserve

My second test was less successful as it involved adapting a current form to use this method of expanding fields. The form was a converted word doc and it basically exploded when I set the layout to flowable. There were so many remnants from word that most of the form was jettisoned off the bottom of the page. It looked like garbage.

Here’s the form before:

Screen shot: a view of the word converted form before flowable layout applied
Screen shot: a view of the word converted form before flowable layout applied

Here’s the form after all the elements are wrapped in a subform and ‘Flowable’ layout is applied:

Screen shot of the form after 'flowable' layout is applied
The form after ‘flowable’ layout is applied

So we resolved to rebuild the form from scratch and it’s working nicely:

Screen shot of the new form created in LiveCycle
Screen shot of the new form created in LiveCycle

A few important (but less obvious) tool windows / panels:

Screen shot: Hierarchy

Screen shot: tab order
Tab order

Hierarchy is important because the flowable layout (with: ‘top to bottom’ flow direction) relies on the order of the elements for positioning. For example, inserting a text box automatically adds it to the bottom of the document. Hierarchy allows you to put it in your desired location. Tab order is valuable for the same reasons.

The last points I’ll mention are margins, pages, tables, a workflow suggestion and a note about Reader:

  • Margins: You’ll need to use each elements’ margins for spacing.
    Every text box, field, table and line will be smashed together unless you space them out with margins.
    The other option is to insert subform with the content ‘Positioned’ into your flowable subform. In these sections you can move things around as you see fit. I found this valuable for pasting in strangely formatted content from word when it didn’t have any form fields in it.
  • Pages:
    One interesting limitation in pdfs is that subforms cannot extend past the existing page. So each page must have it’s own flowable subform. I tried repeatedly to highlight all the content on my 3 page form and put it into one subform but that was fruitless. Update: check each field’s box: “Allow Page Breaks within Content” for correct this behavior. See the Sample Notes for more info.
  • Tables: Tables are archaic in LiveCycle. Only one element can go in a row so you have experience building web pages a dozen years ago you’ll be a pro. In order to make things appear as if there are multiple fields or descriptions in a table row you have to manipulate borders across multiple rows and columns. Personally I’m glad I already created these nero-pathways.
  • My workflow
    In the end I needed to create a dynamic pdf from scratch in LiveCycle and use an existing pdf as the model.
    For my workflow I opened the model in acrobat pro and was able to quickly switch back and forth to check my positioning and highlight, copy, paste content. As a rule I don’t re-type anything, it only creates an opportunity for error.
  • Reader
    As with any PDF form the most important point (especially for the end user) is that they can ‘Save’ the finished document. Printing and emailing is good but allowing them to save is courtesy that I consider a necessity. To do this, open the finished form in Acrobat Pro and navigate to the ‘Advanced’ menu. Then choose ‘Extend Features in Adobe Reader’. And save the document. I always save over my existing document. It converts back later if/when you need to make edits.

    Screen shot: 'Exte<u>n</u>d Features in Adobe Reader'.
    Screen shot: ‘Extend Features in Adobe Reader’.

That’s it. Winter PDF Magic!
Just don’t forget to save it as a Dynamic PDF: Screen shot of Save As dialog.


Document Notes Page Breaks
FlowableTest.pdf with two comment fields that expand until you grow tired of it! Again here’s the test document if you’d like to download it Allow Page Breaks within Content is enabled.
Self_Assessment_Form-fillable-expanding-1 5-5-14 – Here’s an additional sample that’s more of a real-world example Allow Page Breaks within Content is not enabled.
Self_Assessment_Form-fillable-expanding-allow_page_breaks-2c 2-11-15 – Here’s a modified real-world example where content breaks across pages Allow Page Breaks within Content is enabled.

Sample Notes

Sample Notes

  • Note: 2-11-2015 – I amended the above bullets to highlight a difference in the samples that just came to my attention; not all field content will break across pages. There’s a nuance in the form creation that shouldn’t be overlooked or some content will be hidden behind a newly created page. This is addressed in
    the post above where I quote in Stefan Cameron’s response to to Craig Lambson. I followed the instructions explicitly when creating the Self_Assessment_Form-fillable-expanding-1 sample but after the form was complete I made a few changes that rendered the option: “Allow Page Breaks within Content” invalid.

    • If you want to see the issue in action, you can follow along; Paste a 12 paragraph excerpt of text into either field in the first sample: FlowableTest.pdf, all the resulting text will be visible across pages, and it will be printable.
      Screen Shot of content breaking across pages

      Here you can see the content breaking across pages. Success

    • Now if I paste the same 12 paragraphs in to a field in the second sample (Self_Assessment_Form-fillable-expanding-1) only text that fits on one page is visible, any overflow is hidden.
      View of the content not breaking across pagest

      If you open the thumbnail, you can see the content is only visible on the first page. Consequently an additional page is generated to accommodate the length of the text but it is blank. Failure

Reparing / Updating the 2nd sample document
  • Here’s how I repaired my real-world example: Self_Assessment_Form-fillable-expanding-1 in a few short steps (and you can follow along).
    1. First verify each textfield object properties. I’d forgotten to "Allow Page Breaks within Content" for each field.
      • To fix this:
        • Choose the text field (or all relevant text areas)
        • open the object panel
        • under the field tab
        • check the box: Allow Page Breaks within Content.
          Allow Page Breaks within Content

          Here’s a look at the checkbox: Allow Page Breaks within Content. Check that box!

    2. Next look at any adjacent objects and remove "Keep with next"
      • I had added descriptive text blocks above each text area and tied them to the text areas.
      • The offending setting was the checkbox "Keep with next"
        1. Select the descriptive text objects
          Screen Shot of the text objects
        2. Uncheck the box: "Keep with next"
    3. Now double check your preview settings; File -> Form Properties -> Preview.
      Screen Shot of the preview options, ensuring you use Dynamic XML Form
      Preview Type should be: "Interactive Form" and Preview Adobe XML Form As should be: "Dynamic XML Form"
    4. Troubleshooting:
      • You might also double check for any warnings; e.g. Be sure you are publishing to a version of Acrobat that supports Allow Page Breaks Within Content. i.e. Acrobat 9 or higher.
        I received a warning when reviewing my form.
        Image of warning: you must publish to a version of Acrobat supports Allow Page Breaks Within Content
        I set that value in my form properties:
        Screen Shot Acrobat Version compatibility
    5. Don’t forget to extend features to Reader in Acrobat Pro.
  • Now we have the fully functioning version of the 2nd sample form (above: Self_Assessment_Form-fillable-expanding-allow_page_breaks-2c).
  • Rob says:

    All this advice is great thanks, and is still relevant to CS6.

  • ArrueiraV says:

    Thanks for the walkthrough! The test file is indispensable.

    Do you know if there is a way to get the field to resize as the user creates new lines? With the instructions above the field resizes to fit the content after we click another field (onBlur I would guess).

    • Vid says:

      You’re welcome.
      You’re right, the field resizes ‘onBlur’. I suspect there could be a way to expand the field as the user is typing but since we’re relying on the built-in “flowable” method we don’t have obvious access to the underlying functions and vars. Stefan Cameron (http://forms.stefcameron.com) may have some code that would help.

      • ArrueiraV says:


        One more question if you don’t mind. Do you know if a row can expand to accomodate multi-line text fields in its cells? If it can be done, then what are the settings to achieve that?

        I am using a table in flowable layout with repeating rows. I can probably size the rows to be two lines of text tall but if that height could be dynamic that would be much better!

        Thanks again!

  • Avoidingwork says:

    This figuratively saved my bacon. Thanks for this write up and your example.

    I do have one question that I’m not sure if you answered at the end or not. I will need the end user to save what they have filled in as a static pdf and for them to keep the version that they can edit again.

    We expect the end user to download our pdf; fill it in; submit a version that is static and can’t change; make changes to the original on their computer and then submit that new version as a static pdf again.

    Thanks much.

  • Shannon says:

    I am trying to make my PDF templete form expand in LiveCycle but I have changed everything to flowed except the sheet. when I change that to flowed it all moves to the left and my table and all the content are gone? I dont think I would be able to start this from scratch as it has alot of tables, radio button, check boxes, and drop downs. Is there anything I can do?

  • Smaro436 says:

    Is there a way to make an expanding text field push existing text sideways?

    I’ve created an expandable text field that expands in height and pushes existing text down.

    But I need it to push text sideways. I changed the setting in the text field to width and put a text box with text in it beside it but it just runs right over the text box instead of pushing it to the side.

  • Pa says:

    You should do a video of this and put it on YouTube. There isn’t a very good video out there that tells all this.

  • Arvind Kumar says:

    Oh My God, What a great sample it was. I was wondering about that same from the last 7 days but got nothing on the net and even i failed myself. But you made my day. Thanks alot.

  • Dale says:

    Thank you! This article was awesome and helped immensely!

  • Bryce Canyon says:

    How about sharing the apparently Top Secret secret to putting a text field into a subform? There is no information anywhere about doing that.

  • Nidiam Conesa says:

    Awesome instructions!!! I had no idea what you were talking about half of the time but I was able to follow. And… it worked! thanks

  • Eoin Guidera says:

    This is gold dust. I work in a special schools where we use a lot of forms (Individual Education Planning Forms,etc). Staff were exorcised that the fields could not resize. The only difficulty is that LiveCycle is supported on the Mac OS which I use to develop the forms. Can’t find any version for Mac. Do I need to move to PC? Thanks Again.

  • Eoin Guidera says:

    That should have been LiveCycle NOT supported on Mac OS. (Comment Sept. 4th above)

  • NancyS says:

    Let me first start off by saying I am working on an iMac using OSX. My main programs are Indesign CS6 & Acrobat XI. I need to create a dyanamic pdf that will have a paragraph of copy but I need to insert into that paragraph a variable field that must be able to grow with the variable information as well as reflow the other text of the paragraph. I need help! I can’t find anything on this.

  • Marissa Day says:

    Great instructions! I’m stuck though because ‘Allow Page Breaks within Content’ is grayed out.

    I’m on Adobe Livecycle Designer ES3 Version 10.0. I have a 7 column table named Table1 with a combination of text input, numeric input and calculated fields. I have a Header Row, Row1, and Footer Row. The Footer Row has two buttons to ‘Add Row’ and ‘Delete Row’ with a show:click Javascript that says “Table1.Row1.instanceManager.addInstance(1);”

    I’ve checked the following:
    1. My form is saved as Adobe XML Dynamic and Preview is Interactive.
    2. My text input boxes are checked to ‘Allow Multiple Lines’ and Height is ‘Expand to Fit’.
    3. Table1 is wrapped in a Subform (called Table) that is set to Flowed. Subform Table is wrapped in another subform called Header which is also set to Flowed.

    Any suggestions?

  • Terrisa says:

    I really appreciate you sharing this information as it is exactly the solution I’m looking for…until I realized I could not digitally sign the PDF since the feature is disabled in both Acrobat Reader and Acrobat Pro XI.
    Is there some reason the digital signature feature is disabled in your examples? I don’t have LiveCycle designer but I’m trying to get my company to buy a license if I can just get the signature to work.

    Please advise and many thanks!

    • vid@uoregon.edu says:

      I couldn’t say why the digital signature feature is disable. Although it’s not something I use and so never noticed. If you have any notes on configuration after you get your LC Designer installed, pass them on. Thanks.

  • RGF says:

    I use Livecycle ES4 v11 – Other than Livecycle Server – do you know if there is there a way to insert xml data into a template via PHP and maintain floating fields globally bound to text boxes?? I can inject xml data into a static pdf with no problem but the floating fields in flowable containers is stumping me.

    • vid@uoregon.edu says:

      Great question. I don’t know, other than finding another unique identifier to use to target the xml placement. If you have an example of where it works and where it doesn’t perhaps someone could point out the solution.

      • RGF says:

        I can insert xml data into a basic Livecycle form – the field names are basically concatenated from “formname[0].subform[0].dataname[0]”. When using floating fields with global binding I cannot discover a way to find to reference the floating field.

      • RGF says:

        I can locate the field name for the text boxes – it’s in the form of document[0].subform[0].fieldname[0] – and successfully write to them in a livecyle generated pdf form. I can’t find a way to locate the names of the floating fields that are globally bound to document[0].subform[0].fieldname[0]. I’m happy to post a form if that will help.

  • MK says:

    I’m having the issue where I get the field to expand but it writes over the other data. I think you’re saying I need to wrap the data into a subform. But the data was just an imported word document and I cannot figure out what to select on the hierarchy to include the proper fields. The hierarchy is very confusing.

    • vid@uoregon.edu says:

      Right; anytime your pdf is generated from a word document the hierarchy is going to be complex. Personally I found it to be unreasonably so.
      Theoretically the word generated pdf could be ‘flowed’ so that it works but my recommendation continues to be, that you create the form from scratch. I think that would take less time and then you have control over the form, it’s sections (subforms) and how they interact when one field expands with no surprises.

  • Preetha Ravichandran says:

    I want to know how to position a checkbox control at the end of a text of variable length. I’ve tried all possible properties. But checkbox doesn’t change its position according the length of the text. Can someone help?

    • Nichole W. says:

      Hello Preetha Ravichandran,
      I know you asked back in March, but here goes:

      There are a few ways to go about doing this, but the best way is probably to put the ‘text of variable length’ field and your checkbox control field into their own subform (highlight both, right-click, and choose ‘Wrap in Subform’).

      On the hierarchy for your new subform, make sure that the text field is before/above the checkbox control field.

      Then, on the object palette for your new subform, change the content to ‘Flowed’. Keep the flow direction as ‘Top to Bottom’ to make it easier.

      That should be all it takes.

  • Dick says:

    I am following your instructions to a T, and your 2nd form works the way it is supposed to. However, my form is still giving me the plus sign and the field is not expanding as expected.

    I am using Livecycle version 11 and Acrobat XI Pro. Anything that you are aware of that would prevent it working according to what you have here?

    • vid@uoregon.edu says:

      Hi Dick; Nothing that I’m aware of. I’m still back a version though, so I can’t test that directly.

  • Dick says:

    I am experiencing your FAIL of your 2nd sample document.

    I was able to get text boxes and labels to shift, but they would not shift to the 2nd page. It just started disappearing, like your example of the 12 paragraphs being pasted into the “Self_Assesment_Form-fillable-expanding-1” form. I went through the same steps you advised I check, but nothing would extend it to the second page. Any suggestions?

    • vid@uoregon.edu says:

      Hmm, well if you’re looking at the Hierarchy you may find a new element that I didn’t account for. You could walk through each of those upper level elements and see if changing one to flowable might make the difference. If you want to post the form somewhere perhaps we could take a look.
      Which makes me think there ought to be a StackOverflow for flowable PDF challenges, but I haven’t found one.

      • vid@uoregon.edu says:

        Update; Dick and I looked at his form and we determined that we needed to make the parent subform “(untitled Subform)(page 1)(no caption)” flowable instead of the default: ‘positioned’.

        In hindsight, this was likely due to the presence of a blank 2nd page which ended up being its own Subform in the document structure.

  • Zev says:

    Is there a way to apply this to PDF content (not input text) to mak expandable and collapsible PDF documents?


  • lorretadt says:

    Try the batch add text box in pdf document directly and easily with high quality on rasteredge page http://www.rasteredge.com/how-to/csharp-imaging/pdf-text-edit-insert/.

  • Joaquin says:

    I had been struggling with this for many days without success. I’m really grateful that I found your post, it’s been really helpful for me.
    There’s one thing I haven’t been able to accomplish tough (and I’m not sure that if it’s actually possible).
    I’d like to know if there’s a way (that you know of) to have a two-column flowed subform. It would be quite similar to what you have in your real-world example, in the ‘person_info_subform’ but with 2 columns instead of 3 (those ones are in a Positioned subform and don’t grow, I would need them to be in a flowed subform for them to grow in heigth as needed).
    I don’t know if you’re still around (since the post if from a few years now) but I would be really grateful if you could answer.

    Thanks in advance

    • vid@uoregon.edu says:

      Hi Joaquin;
      I’m not sure; I haven’t seen that. In fact, I haven’t come across many other expanding forms in the wild. It seems plausible, you may have to try limiting the width while allowing for expanding height.
      Let me know if you work it out.

      • Joaquin says:

        Well after a little more research I’ve been able to work it out!
        I just wrapped my three TextFields in a Positioned Subform (which is in a Flowed page) so I can move the TextFields around.
        It’s important that the “auto-fit” (in height) box is checked in the “Layout” tab of the Positioned Subform (in order to make it possible for the TextFields to expand to a new page if necessary).
        Also, the “Allow multiple lines” and “Allow Page Breaks within Content” boxes in the “Field” tab of each TextField should be checked, as well as the “Expand to fit” (in height) box in the “Layout” tab.
        And that’s it.

Leave a Reply to RGF