Hi HarveyLiu,
Does this you ask? It will export the pages which have underlined text.
var doc = app.documents; app.findTextPreferences = null; app.findTextPreferences.underline = true; for(var i=0;i<doc.length;i++) { var found = doc[i].findText(); var _pages = []; for(var j=0;j<found.length;j++) { var txfms = found[j].texts[0].parentTextFrames; for(var k=0;k<txfms.length;k++) { _pages.push(txfms[k].parentPage.name); } } for(var j=0;j<_pages.length;j++) { if(_pages[j] === _pages[j-1]) { _pages.splice(j,1); } } if(_pages.length != 0) { app.pdfExportPreferences.pageRange = _pages.toString(); doc[i].exportFile(ExportFormat.PDF_TYPE, new File(doc[i].fullName.toString().replace(/\.indd$/i,".pdf")), false); } _pages = []; } app.findTextPreferences = null;
Regards,
Chinna