Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Split/Extract pages by bookmarks

$
0
0

I have created a script which will successfully split the pdf at the first bookmark.

 

I need for the script to split all bookmarks from the pdf. 

 

I have modifed the script but the console reports the following error:

TypeError: bookmarkRoot.children[i] is undefined

 

Can someone please provide assistance to modify the script to split all bookmarks from the pdf?

 

Script to split the pdf at the first bookmark - this works!

 

if (this.bookmarkRoot.children!=null)
{
var bm = bookmarkRoot.children[0].execute();
var bmname = bookmarkRoot.children[0].name;
this.extractPages({nStart:bm, cPath: "/C/Temp/"+bmname+".pdf"});
}

 

Script to split all bookmarks in the pdf - this does not work!

 

if (this.bookmarkRoot.children!=null)
{
for (var i=0; i < this.bookmarkRoot.children.length; i++)

var bm = bookmarkRoot.children[i].execute();
var bmname = bookmarkRoot.children[i].name;
this.extractPages({nStart:bm, cPath: "/C/Temp/"+bmname+".pdf"});

}

 

Thank you!


Viewing all articles
Browse latest Browse all 12130

Trending Articles