How to insert templates into a specific place within PDF document
Hi,
I am trying to create an interactive PDF which add/deletes pages in a specific order based on a number of check boxes. Currently I can add and delete pages using a code similar to the following - which I have pieced together from a number of threads:
if(event.target.value!="Off")
{this.getTemplate("Template1" ).spawn();}
else
for (var p=this.numPages-1; p>=0; p--) {
if (this.numPages==1) break;
for (var n=0; n<this.getPageNumWords(p)-1; n++) {
if (this.getPageNthWord(p, n) == "FirstWord" && this.getPageNthWord(p, n+1) == "SecondWord" && this.getPageNthWord(p, n+2) == "ThirdWord") {
this.deletePages(p);
break;
}
}
}
However, the order in which these templates are placed into the document is important and if a check box is checked and then unchecked, the order is lost and templates are just added to the end of the document. I have attempted to specify the page that templates are inserted using: .spawn({nPage:1}) but this has led to pages being inserted on top of one another becoming illegible. Does anyone have any ideas on how to fix this?
Any help would be appreciated!
