Skip to main content
Participant
September 18, 2020
Answered

Spawning template specifically & buttons in chrome.

  • September 18, 2020
  • 2 replies
  • 942 views

Im trying to make a form. I got a page with buttons to spawn extra templates when need, but cant figure out how to spawn the page at a specific point in the pdf because they have a specific order. And be able to spawn all of them this way. 

 

Heres my most recent code attempt(I know little javascript):

 

var a = this.getTemplate("TOC");

var s = 0;

if ( s<1 ){
s = 1;
var x = 2;
}

x = x + 1;

a.spawn(x,true,false);

 

 

Secondly, during testing I was opening the pdf via google and found that the buttons or spawning code wasnt working in google. Is that normal?

This topic has been closed for replies.
Correct answer George_Johnson

Yes, that's normal. Most non-Adobe PDF viewers have no support for templates or the JavaScript methods used to manipulate them.

 

That code doesn't make a lot of sense to me, since the following is functionally equivalent:

 

// Create a new page after the 4th page of this document

this.getTemplate("TOC").spawn(3, true, false);

 

Why all the variables?

 

2 replies

JR Boulay
Community Expert
Community Expert
September 20, 2020

Chrome is a web browser.

Would you expect an HTML file to work in Acrobat as in a web browser?

Acrobate du PDF, InDesigner et Photoshopographe
George_JohnsonCorrect answer
Inspiring
September 18, 2020

Yes, that's normal. Most non-Adobe PDF viewers have no support for templates or the JavaScript methods used to manipulate them.

 

That code doesn't make a lot of sense to me, since the following is functionally equivalent:

 

// Create a new page after the 4th page of this document

this.getTemplate("TOC").spawn(3, true, false);

 

Why all the variables?

 

Participant
September 19, 2020

I was thinking the variables could be used so every time the button is pressed the nPage would increase by one.