Move fields up if another field is empty?

New Here ,
Jan 25, 2018

Copy link to clipboard

Copied

I have a 4-page form of which the 4th page is a summary of the data entered on the first 3 pages. I'm 'building' this 4th page using form fields that get their data from the other pages. While it works really well, there is one thing I'm hoping is possible:

If a field (let's say field C on page 1) is empty, it won't get shown on page 4, but there will be space 'reserved' for the data, creating a gap between fields B and D. In that case, I'd like to have all fields following field C to move up the page and 'close the gap'.

Is this possible?

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

Yes, it is possible. Scripts can move field locations in Acrobat/Reader. I don't know how other viewers will handle such code. They probably won't, but I know it will work in Acrobat and Reader.

The location of the field is determined by it's "rect" property. You'll need to learn about PDF page coordinates and performing simple geometry calculations.

Here is an article on page coordinates, which includes scripts for moving fields

PDF Page Coordinates (page size, field placement, etc.)

Check out the "Swat the Fly Game" and "Bouncing Button" sample files here:

Free Sample PDF Files with scripts

Both move fields. And the scripts are open for you to see.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

170

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Move fields up if another field is empty?

New Here ,
Jan 25, 2018

Copy link to clipboard

Copied

I have a 4-page form of which the 4th page is a summary of the data entered on the first 3 pages. I'm 'building' this 4th page using form fields that get their data from the other pages. While it works really well, there is one thing I'm hoping is possible:

If a field (let's say field C on page 1) is empty, it won't get shown on page 4, but there will be space 'reserved' for the data, creating a gap between fields B and D. In that case, I'd like to have all fields following field C to move up the page and 'close the gap'.

Is this possible?

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

Yes, it is possible. Scripts can move field locations in Acrobat/Reader. I don't know how other viewers will handle such code. They probably won't, but I know it will work in Acrobat and Reader.

The location of the field is determined by it's "rect" property. You'll need to learn about PDF page coordinates and performing simple geometry calculations.

Here is an article on page coordinates, which includes scripts for moving fields

PDF Page Coordinates (page size, field placement, etc.)

Check out the "Swat the Fly Game" and "Bouncing Button" sample files here:

Free Sample PDF Files with scripts

Both move fields. And the scripts are open for you to see.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

171

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 25, 2018 0
Adobe Community Professional ,
Jan 25, 2018

Copy link to clipboard

Copied

Yes, it is possible. Scripts can move field locations in Acrobat/Reader. I don't know how other viewers will handle such code. They probably won't, but I know it will work in Acrobat and Reader.

The location of the field is determined by it's "rect" property. You'll need to learn about PDF page coordinates and performing simple geometry calculations.

Here is an article on page coordinates, which includes scripts for moving fields

PDF Page Coordinates (page size, field placement, etc.)

Check out the "Swat the Fly Game" and "Bouncing Button" sample files here:

Free Sample PDF Files with scripts

Both move fields. And the scripts are open for you to see.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 25, 2018 0