Skip to main content
rhodav
Participant
April 29, 2018
Answered

how to show/hide pages in an adobe acrobat form

  • April 29, 2018
  • 4 replies
  • 24401 views

I have created a form in which I want the users to be able to add more context if need be on a second page.  How do I set up the form to show a second page if needed?

Correct answer George_Johnson

You'll need to use JavaScript.

Begin by adding the page that you want to be shown when needed. In Acrobat, you can make a page a template, which is really nothing more than giving it a name. You should then set the template to hidden. Exactly how you do these steps depends on which version of Acrobat you're using.

You then have to provide some means for the user to generate a new page that's based on the template. A possible way is to add a button to a page and include a script like the following as the Mouse Up JavaScript:

// Get a reference to the template

var t1 = getTemplate("Template1");

// Create a new page, but only if there's currently only one page in this document;

if (numPages == 1) {


     t1.spawn({nPage: numPages, bRename: true, bOverlay: false});

} else {

    // Do nothing, since the page has already been added

}

This is about the minimum script, so post again if you need it to do anything else.

Note that mobile and some non-Adobe PDF viewers (including browsers) do not have support for spawning templates, so your users should have at least Adobe Reader for WIndows/Mac.

4 replies

Participant
January 4, 2021

I have a lengthy form that I only need parts of filled out depending on my clients needs.  I have created each section on a different page.  I'd like to be able to use conditional formating to turn pages from hidden to visable with a check in a checkbox.  Is this possible?  If so, How can I accomplish this?

 

Participant
January 11, 2021

Hello,

Did you find a solution to this question?

Participant
April 16, 2025

hi, did you get the solution ? 

rhodav
rhodavAuthor
Participant
May 2, 2018

Thank you for your help.  I do have one last question, I hope.  So, I've created the template page and inserted it into my form.  After a couple of people reviewed the form I had some modifications which affected the template page.  When I updated the template and re-inserted it into my form, the old version of the template keeps showing up when I click the add "pg2" button that I had originally created.  Would I have to re-write the java script on that button even though I've named the template page the same as what I did before?

Inspiring
May 2, 2018

Did you replace the hidden template?

George_JohnsonCorrect answer
Inspiring
April 29, 2018

You'll need to use JavaScript.

Begin by adding the page that you want to be shown when needed. In Acrobat, you can make a page a template, which is really nothing more than giving it a name. You should then set the template to hidden. Exactly how you do these steps depends on which version of Acrobat you're using.

You then have to provide some means for the user to generate a new page that's based on the template. A possible way is to add a button to a page and include a script like the following as the Mouse Up JavaScript:

// Get a reference to the template

var t1 = getTemplate("Template1");

// Create a new page, but only if there's currently only one page in this document;

if (numPages == 1) {


     t1.spawn({nPage: numPages, bRename: true, bOverlay: false});

} else {

    // Do nothing, since the page has already been added

}

This is about the minimum script, so post again if you need it to do anything else.

Note that mobile and some non-Adobe PDF viewers (including browsers) do not have support for spawning templates, so your users should have at least Adobe Reader for WIndows/Mac.

rhodav
rhodavAuthor
Participant
April 30, 2018

Thanks George.  I got this to work.  Now, I need to save my master form to a reader extended file form so that users that only have adobe reader can use the form and have the ability to use the second page if needed.  When I tested it, I can’t get the “page2” to come up when I click the button.  Is this because the spawning of template pages doesn’t work with that version of reader?  The version is: Adobe Acrobat Reader DC.

[Personal informations removed by moderator]

Bernd Alheit
Community Expert
Community Expert
April 30, 2018

For Acrobat Reader DC you don't need the reader extension.

Inspiring
April 29, 2018

If all users are using Acrobat, then one can use the template feature to show or hide pages set with the template property.