Copy link to clipboard
Copied
I just finished creating an interactive pdf but the text boxes I created wont expand when the text box is full, it keeps going but wont to the next line (I dont know how to explain it). Is there a way to have an expandable interactive text box or would I need to use another app?
Copy link to clipboard
Copied
You create your form in InDesign and fine tune it in Acrobat Pro.
You can't expand the size of the Text field once it's created but you can change the properties to multi-line and scroll long text so you can get more text in the field (you can limit the number of characters in the field too) . Do this under the Options tab in Text Field Properties in Acrobat Pro.
Copy link to clipboard
Copied
Set your text field up to be multiline and scrollable. There is no way to make the text field expand.
Copy link to clipboard
Copied
It is possible by attaching some Javascript to the format event of the text field.
As the user types, you would keeping checking whether the field overflows, and if it does, expand it (modify its coordinates).
It's a little trickier to shrink the field as needed (because then there is no overflow, so how to know it's not filled?)
I don't have the Javascript to hand, and will try to post it later. I have played around with it in the past, and it is a little messy -- I think there was a problem of the input cursor jumping to the beginning of the field when the field was expanded.
Also, unless this is the last field in the form, what will you do if fields start overlapping. And what will you do if you reach the bottom of the page? (Again, these issues could be solved by reprogramming the coordinates of all the other fields, I guess).
I'll try to post something later, but it's a bit of a messy solution, I think...
Copy link to clipboard
Copied
Messy is probably an understatement. I intentionally didn't mention trying that because another scenario is having multiple fields doing this. It's one of those things that I would file under "just because you can, doesn't mean you should."
This type of thing is best reserved for responsive forms on websites.
Copy link to clipboard
Copied
Here's a proof-of-concept. It's quite cool in a geeky way 8-)
The attached PDF has 2 text fields that expand as needed to accommodate the text. As the top field expands, it pushes the rest of the form down.
To see how this is done, take a look at the custom keystroke script attached to the text fields (copied below).
This has been tested and works in Acrobat. It requires a PDF reader with full Javascript support (like the free Adobe Reader on desktop).
if ( event.fieldFull )
{
theFields = ["Text Field 2", "Text Field 3"];
// Move other fields down
for (i = 0; i < theFields.length; i++){
f = this.getField(theFields[i]);
b = f.rect;
b[1] -= 20;
b[3] -= 20;
f.rect = b;
}
// Enlarge active field
f = event.target;
b = f.rect;
b[3] -= 20;
f.display = display.hidden;
f.rect = b;
event.change = event.changeEx;
f.display = display.visible;
f.setFocus();
}