Copy link to clipboard
Copied
I am making a PDF using Adobe Acrobat Pro and would like to be able to change the position of text boxes on a page based on end user input. The specific scenario I am working with is if a user indicates that they will have a car or cars, that they will be able to add the specifics of each vehicle. I currently have a yes/no radial option and I have it set so that if the user selects "yes" boxes are made visible below the prompt asking for make, model, etc. If the user has more than one vehicle, I have added a "+" button that makes visible another set of boxes asking again for make, model, etc. The issue I am running into is that I need this question to be in the middle of my form and all the fields below are now moving down. How would I make it so that as more lines of boxes become visible, everything below naturally move down.
Copy link to clipboard
Copied
Regular AcroForms don't have any kind of automatic content or form field reflow. Trying to emulate this behavior is generally considered a fools errand, but if you want to put in the work, it can be done.
First, a script can only move form fields, not page content. So all static text also has to be in a form field so it can be moved, i.e. the actual pages must be blank. Next, it is not possible to move fields to a new page. So if this is necessary, you'll need to delete fields on one page, and create fields on the next page.
Managing this type of process is complicated, especially if the design changes, which it will since you are in the beginning stages. To support field managment it will be necessary to maintain a data set of field status, i.e. where a field is currently located, and to have functions for adding fields and setting all field positions, based on the positions of fields that come before them in the field order.
Take a look at the "Bouncing Button" sample here:
https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm
It has code that creates new fields and moves them about on the page.