• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Move fields up if another field is empty?

Community Beginner ,
Jan 25, 2018 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?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

416

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
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 25, 2018 Jan 25, 2018

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 t

...

Votes

Translate

Translate
Community Expert ,
Jan 25, 2018 Jan 25, 2018

Copy link to clipboard

Copied

LATEST

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.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
community guidelines