How to Expand a Fillable Section of Pdf

Addendums
  • 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.
Arg…
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
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.

Samples

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:
    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).

How to Expand a Fillable Section of Pdf

Source: https://blogs.uoregon.edu/developments/2010/12/29/pdf-making-text-fields-grow-to-accommodate-text/

0 Response to "How to Expand a Fillable Section of Pdf"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel