Copy link to clipboard
Copied
Good afternoon,
I currently use Adobe Acrobat Pro, and in one of the drop down fields under format, custom keystroke, I am using the following code:
this.getTemplate("Temp 1").hidden = true;
if (event.willCommit)
{
switch(event.value)
{
case "2":
this.getTemplate("Temp 1").hidden = false;
break;
Temp 1 is basically a page out of 30 pages that we have converted to a template (under organize pages, selected the page and select page templates and gave it the name).
when the code above is run, temp 1 is appearing as the last page. I tried a lot of approaches to try to make it appear as page #4 and nothing seems to be working. I tried different AI to get the right code but I am pretty sure I am missing several steps.
What is the best approach to make this page appear under page 4 when option 2 is selected from the drop down, while making sure its hidden again when I go back to option 1.
thank you.
Copy link to clipboard
Copied
If your file have 30 pages when you spawn template, you can try this as validate script of dropdown field, it will spawn template as fourth page and delete that page if dropdown is not 2 and number of pages are 30:
var t1 = this.getTemplate("Temp 1");
if (event.value == "2"){
t1.spawn({nPage: 3, bRename: false, bOverlay: false});}
else if(event.value != "2" && this.numPages == 30)
this.deletePages(3);
Copy link to clipboard
Copied
Before answering your question: Is this file supposed to be used in Reader, or only in Acrobat? Because the hidden property can't be set in the former...
Copy link to clipboard
Copied
If your file have 30 pages when you spawn template, you can try this as validate script of dropdown field, it will spawn template as fourth page and delete that page if dropdown is not 2 and number of pages are 30:
var t1 = this.getTemplate("Temp 1");
if (event.value == "2"){
t1.spawn({nPage: 3, bRename: false, bOverlay: false});}
else if(event.value != "2" && this.numPages == 30)
this.deletePages(3);
Find more inspiration, events, and resources on the new Adobe Community
Explore Now