Skip to main content
Participant
November 7, 2022
Answered

Enable javascript for Adobe reader

  • November 7, 2022
  • 1 reply
  • 2018 views

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?

This topic has been closed for replies.
Correct answer try67

Thank you. 
Can you give me one example of how that script could look like? For example to spawn and delete one template? 


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.

1 reply

Bernd Alheit
Community Expert
Community Expert
November 7, 2022

What script does you use?

Does you spawn template pages?

Participant
November 7, 2022

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;;
}

 

 

try67
Community Expert
Community Expert
November 7, 2022

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.