Can I spawn two template pages using one button?

New Here ,
Mar 31, 2021 Mar 31, 2021

Copy link to clipboard

Copied

I have a 14 page pdf in which i need to offer the user the option of adding additional pages 5-8, however, I need to offer it in pairs now. So, spawning 5+6 together after the original page 6 and deleting the original page button. Then the option of spawning 7+8 together after the original page 8 and deleting the original button.

Currently, it is set up to spawn each page singularly. Can I just update the script to spawn two page templates instead of just one? This is my script. TIA! This forum is wonderfully helpful.

 

this.getField("Additional Page 5").display=display.noPrint;
var a = this.getTemplate("5");
a.spawn({nPage: pageNum + 1, bRename: true, bOverlay: false});
this.getField("Additional Page 5").display=display.hidden;
event.target.display=display.hidden;
this.pageNum=this.pageNum+1;

TOPICS
JavaScript, PDF forms

Views

86

Likes

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
Adobe Community Professional ,
Mar 31, 2021 Mar 31, 2021

Copy link to clipboard

Copied

You can add a second getTemplate and spawn.

Likes

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
Adobe Community Professional ,
Mar 31, 2021 Mar 31, 2021

Copy link to clipboard

Copied

LATEST

You just have to repeat the spawning instruction:

 

this.getField("Additional Page 5").display=display.noPrint;
var a = this.getTemplate("6");
a.spawn({nPage: pageNum + 1, bRename: true, bOverlay: false});

var a = this.getTemplate("5");
a.spawn({nPage: pageNum + 1, bRename: true, bOverlay: false});
this.getField("Additional Page 5").display=display.hidden;
event.target.display=display.hidden;
this.pageNum=this.pageNum+1;

Likes

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