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

2 questions on spawning templates

New Here ,
Feb 12, 2021 Feb 12, 2021

Copy link to clipboard

Copied

Good evening,

I have 2 questions re: spawning templates in a pdf.  Below is the code I have attached to a button in the document:

var interview1 = this.getTemplate ("interview1");
var interview2 = this.getTemplate ("interview2");
var interview3 = this.getTemplate ("interview3");
var interview4 = this.getTemplate ("interview4");
var interview5 = this.getTemplate ("interview5");
var interview6 = this.getTemplate ("interview6");

interview1.spawn();
interview2.spawn();
interview3.spawn();
interview4.spawn();
interview5.spawn();
interview6.spawn();

getField ("interview1.LAST_NAME").setFocus();

Currently when I click the button, it loads a 6 page interview form to the END of the pdf. 

 

Question 1) How do I get it to load to the BEGINNING of the document?

 

Question 2) How do I get already filled out fields from the core pdf to auto-populate into the spawned template?  For example, an individual already fills out first name, last name, etc. fields into the document prior to me spawning the template.  Right now I have to manually retype their name.  How can I change it to autopull from the core pdf?

 

Thanks!

TOPICS
JavaScript

Views

760

Translate

Translate

Report

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 , Feb 13, 2021 Feb 13, 2021

1.

this.getTemplate("interview1").spawn(0, true, false);

 

You should read this for more infos: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJS/Template_methods.htm?rhhlterm=spawn&rhsyns=%20

 

 

2.

Two solutions:

- use exactly the same for fields that must share their content.

- use a script that replicate the "master" field content to others.

 

 

3.

You should not use the same name for a variable and a template.

 

Votes

Translate

Translate
Community Expert ,
Feb 12, 2021 Feb 12, 2021

Copy link to clipboard

Copied

1) Look at the parameters of the method spawn

Votes

Translate

Translate

Report

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 ,
Feb 13, 2021 Feb 13, 2021

Copy link to clipboard

Copied

1.

this.getTemplate("interview1").spawn(0, true, false);

 

You should read this for more infos: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJS/Te...

 

 

2.

Two solutions:

- use exactly the same for fields that must share their content.

- use a script that replicate the "master" field content to others.

 

 

3.

You should not use the same name for a variable and a template.

 

Votes

Translate

Translate

Report

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 ,
Feb 13, 2021 Feb 13, 2021

Copy link to clipboard

Copied

3) Why not?

Votes

Translate

Translate

Report

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 ,
Feb 21, 2021 Feb 21, 2021

Copy link to clipboard

Copied

This question was already answered: https://community.adobe.com/t5/acrobat/custom-calculation-script-for-if-else-if/m-p/11821823

 

And because this is confusing for humain brains too.

Votes

Translate

Translate

Report

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 ,
Feb 21, 2021 Feb 21, 2021

Copy link to clipboard

Copied

The question was not answered.

Votes

Translate

Translate

Report

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 ,
Feb 22, 2021 Feb 22, 2021

Copy link to clipboard

Copied

Can't you read the OP answer? : "You are awesome! It worked. Thank you so much."

Votes

Translate

Translate

Report

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 ,
Feb 22, 2021 Feb 22, 2021

Copy link to clipboard

Copied

LATEST

This was not a reply to your posting!

Votes

Translate

Translate

Report

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