Range Error on Extracting Pages
Need some help with the following code. Everything works, ie export pages based on bookmarks with temp file names. That is until I add code to go and export the file with the name of its bookmark. Then I get the following error. Any help would be appreciated thanks.
RangeError: Invalid argument value.
Doc.extractPages:7:Document-Level:test
This works
console.clear();
oDoc = this;
bkTrgt = []
this.bookmarkRoot.children.forEach(function(a){a.execute();bkTrgt.push(pageNum);})
bkTrgt.forEach(function(a,i,k){oDoc.extractPages(k,((i+1)<k.length)?k[i+1]-1:oDoc.numPages-1);});
This Doesnt
console.clear();
oDoc = this;
bkTrgt = []
this.bookmarkRoot.children.forEach(function(a){a.execute();bkTrgt.push(pageNum);})
bkTrgt.forEach(function(a,i,k){oDoc.extractPages(k,((i+1)<k.length)?k[i+1]-1:oDoc.numPages-1,oDoc.bookmarkRoot.children.name + ".pdf");});
