Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Buttons for adding and removing page templates in PDF form

Status
Not open for further replies.

Cyoung223

Instructor
Jan 6, 2023
1
US
I am creating a form that has some pages which are optional based on user's needs. I've figured out how to place buttons that will spawn those additional pages based on embedded templates; however, I also want to have buttons that will hide said pages again in case someone adds one in error. The script I used in the buttons to add the pages is this:

var a = this.getTemplate ("Interview notes");
a.spawn();

I tried using this script in a "Remove Page" button...

var currentPageNumber = this.pageNum;
this.deletePages({nStart: currentPageNumber, nEnd: currentPageNumber});

...but unfortunately it deletes the whole page template meaning that the add page button no longer does anything within that version of the file.

I also tried the following:

Add page-

var t = this.getTemplate ("Interview notes");
t.hidden=false

And this for the remove page button:

var t = this.getTemplate("Interview notes");
t.hidden=true

This worked beautifully... until I opened the file in Acrobat Reader rather than Pro, and then it didn't work at all (all template pages were visible all the time).

Basically, I need something that does the opposite of the "spawn" command, and gets that template back to a hidden state without removing it entirely, and works in Adobe Reader.

Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top