Skip to main content
Participant
October 4, 2022
Answered

Spawning template page in acrobat DC reader using button

  • October 4, 2022
  • 2 replies
  • 2829 views

I need help creating the right javascript to spawn a hidden template page in acrobat reader using a button.

 

At the moment i tried numerous javascripts I found on the web but only manage to get one working in acrobat but when i save my form out for use in acrobat reader it fails to activate. 

 

If anyone knows the code to make spawning page templates in reader using a button (I used the ok button field set to transparent and then the mouse up in action tab with javascript selected)

 

I be most grateful (its for my college project).

Correct answer Bernd Alheit

Don't enable reader extension.

2 replies

Nesa Nurani
Community Expert
Community Expert
October 4, 2022

You can use this, just replace "template1" with your template name:

this.getTemplate("template1").spawn(this.numPages, false, false);

Participant
October 4, 2022

This did not work - does the template name have to be one word (thinking what could be the problem?)

Bernd Alheit
Community Expert
Community Expert
October 4, 2022

What script does you use? Can you share a sample file?

Participant
October 4, 2022

This is what i have used so far in a button field with the mouse up action and set to javascript:

 

{

this.getTemplate("Single Reward").spawn(event.target.page+1, true, false);

this.pageNum = event.target.page+1;

}

 

It only works in Acrobat DC but when i save the form using File > Save as other > reader extended pdf >  Enable more tools and open it in acrobat reader DC the button will not spawn the page.

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
October 4, 2022

Don't enable reader extension.