Copy link to clipboard
Copied
I have followed a couple tutorials online showing the process of creating a button with which to add a new page (from a template) inside Acrobat. However I am unable to get it to work.
I am creating a button using the action - Java Script:
var a = this.getTemplate("MyTemplate");
And renaming the template to the one I saved But cannot get the action to work.
Any guidance would be much appreciated.
The info graphic I followed is:
https://acrobatusers.com/tutorials/how-to-build-a-button-that-creates-a-new-page
And others show basically the same procedure.
First of all, it needs to be:
a.spawn();
But the error message means there's no template with that name in your file.
Copy link to clipboard
Copied
What you posted is:
a. a.spawn
But it should be just:
a.spawn
After clicking the button, you should see if there are any error messages in the JavaScript console by pressing cmd+J.
Copy link to clipboard
Copied
Thanks I think that was a typo in my [post...
Here is a copy and paste of the exact Java script (my template is called "add"):
var a = this.getTemplate("add");
a.spawn
Pressing cmd+j after clicking the button with no results gets:
TypeError: a is null
2:Field:Mouse Up
Copy link to clipboard
Copied
First of all, it needs to be:
a.spawn();
But the error message means there's no template with that name in your file.
Copy link to clipboard
Copied
Thanks try67!
That was it!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now