Copy link to clipboard
Copied
I´m trying to create a PDF with a javascript showing different pages (templates) based on a selection in a dropdown list. This works perfectly fine in my Adobe Acrobat Standard (32-bit) but most of the persons that will use the PDF have Adobe Reader (64-bit), but even though they enable javascript in Prefereces, the javascript does not work (i.e., showing only already visible pages (templates)).
Please let me know if I can do someting to make this work?
Copy link to clipboard
Copied
To spawn a page as the last page of the file:
this.getTemplate("Template1").spawn(this.numPages-1, false, false);
To delete the last page of the file:
this.deletePages(this.numPages-1,this.numPages-1);
You should really read the documentation of these methods, though, to know what all the parameters mean.
Copy link to clipboard
Copied
What script does you use?
Does you spawn template pages?
Copy link to clipboard
Copied
This is the script (not spawning templates) which works perfectly fine in Adobe Standard:
this.getTemplate("page 9 P&ID Compact" ).hidden = true;
this.getTemplate("page 10 P&ID CF" ).hidden = true;
this.getTemplate("page 11 P&ID Std" ).hidden = true;
this.getTemplate("page 12 3D Compact" ).hidden = true;
this.getTemplate("page 13 3D CF" ).hidden = true;
this.getTemplate("page 14 3D CF" ).hidden = true;
this.getTemplate("page 15 3D Std" ).hidden = true;
this.getTemplate("page 16 3D Std" ).hidden = true;
if(event.value=="3.2 Compact")
{
this.getTemplate("page 9 P&ID Compact").hidden=false;
this.getTemplate("page 12 3D Compact" ).hidden=false;
}
if(event.value=="3.2 Compact Flex")
{
this.getTemplate("page 10 P&ID CF").hidden=false;;
this.getTemplate("page 13 3D CF").hidden=false;;
this.getTemplate("page 14 3D CF").hidden=false;;
}
if(event.value=="3.2 Standard")
{
this.getTemplate("page 11 P&ID Std" ).hidden=false;;
this.getTemplate("page 15 3D Std").hidden=false;
this.getTemplate("page 16 3D Std").hidden=false;;
}
Copy link to clipboard
Copied
The hidden property of a Template object can't be changed in Reader, only in Acrobat.
If you want to show/hide pages in Reader you must spawn a copy of the Template and then delete that page (using the deletePages method of the Doc object) when you wish to hide it.
Copy link to clipboard
Copied
Thank you.
Can you give me one example of how that script could look like? For example to spawn and delete one template?
Copy link to clipboard
Copied
To spawn a page as the last page of the file:
this.getTemplate("Template1").spawn(this.numPages-1, false, false);
To delete the last page of the file:
this.deletePages(this.numPages-1,this.numPages-1);
You should really read the documentation of these methods, though, to know what all the parameters mean.
Copy link to clipboard
Copied
Thank you so much!
Will continue with reading and trial and error.

