Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert page from template in Acrobat

Explorer ,
Jan 24, 2016 Jan 24, 2016

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");

  1. a.spawn

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.

TOPICS
Acrobat SDK and JavaScript
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 25, 2016 Jan 25, 2016

First of all, it needs to be:

a.spawn();

But the error message means there's no template with that name in your file.

Translate
LEGEND ,
Jan 24, 2016 Jan 24, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 25, 2016 Jan 25, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2016 Jan 25, 2016

First of all, it needs to be:

a.spawn();

But the error message means there's no template with that name in your file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 25, 2016 Jan 25, 2016
LATEST

Thanks try67!

That was it!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines