Code: Select all
var pageArray = [];
for (var p = 0; p < this.numPages; p++) {
// iterate over all words
for (var n = 0; n < this.getPageNumWords(p); n++) {
console.println(this.getPageNthWord(p, n))
if ((this.getPageNthWord(p, n).style.strikeThru === true) || (this.getPageNthWord(p, n).style.underline === true)) {
pageArray.push(p);
break;
}
}
}
if (pageArray.length > 0) {
// extract all pages that contain the string into a new document
var d = app.newDoc(); // this will add a blank page - we need to remove that once we are done
for (var n = 0; n < pageArray.length; n++) {
d.insertPages({
nPage: d.numPages - 1,
cPath: this.path,
nStart: pageArray,
nEnd: pageArray,
});
}
// remove the first page
d.deletePages(0);
}