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

Spawing form and specifying placement

New Here ,
Aug 11, 2016 Aug 11, 2016

I have successfully been able to insert a template into the current form using the formula below, however it places the new page at the end of the document.  I would like to insert the new page immediately after page 4.  The formula I am currently using is:

var expTplt = getTemplate("pg 4");

expTplt.spawn(numPages,true,false)

I am a novice so please be specific as to what the formula should be to insert my template after page 4.   If I can copy and paste it that would be fantastic.  I am using Acrobat Pro DC.

Thank you,

TOPICS
Acrobat SDK and JavaScript , Windows
584
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
LEGEND ,
Aug 11, 2016 Aug 11, 2016

You should look at the Acrobat JavaScript documentation for more information. It explains how the first parameter (nPage) is used, depending on whether you're adding a new page or overlaying the template on an existing page.

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
New Here ,
Aug 11, 2016 Aug 11, 2016

That documentation isn't very easy for a beginner to interpret.  I was hoping someone would just post the code. 

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
LEGEND ,
Aug 11, 2016 Aug 11, 2016
LATEST

You're right, it is confusing because it's wrong about several things. It's been so long since I've taken a critical look at it that I hadn't noticed. So to give you some guidance, to spawn a template and have it create the new page after the fourth page of the document, set the nPage parameter to 4. In your example:

expTplt.spawn(4,true,false);

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