top of page

Script to extract pages with string from multiple PDF files

Karl Heinz Kremer has posted a very useful Java script here. It can be used to extract each page from a set of multiple PDFs that contains a specific string. The script is posted below.


  • You can execute this script in Adobe Acrobat XI by going to Tools . . . Action Wizard . . . Create New Action.

  • In the new dialog box which pops us, from the tools menu on the left, in the 'More Tools' drop down menu, select 'Execute JavaScript'.

  • Click on 'Specify Settings' and then enter the script.

  • Edit the script so the string you want to search for is listed in quotes on the line which begins, 'var stringToSearchFor'.

  • Be sure to uncheck the 'Prompt User' box.

  • Name and save the action.

  • Run the action from the Action Wizard section of Tools.

  • When the action is run you will be prompted to select either mulitple files or a folder.


  • After the script executes, you will be left with one PDF for each source file that only contains the pages from the source file which include the searched for string.




As always I tested this script tonight and confirmed that it works.




// Iterates over all pages and find a given string and extracts all

// pages on which that string is found to a new file.


var pageArray = [];


var stringToSearchFor = "Court";


for (var p = 0; p < this.numPages; p++) {

// iterate over all words

for (var n = 0; n < this.getPageNumWords(p); n++) {

if (this.getPageNthWord(p, n) == stringToSearchFor) {

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[n],

nEnd: pageArray[n],

} );

}


// remove the first page

d.deletePages(0);

}

4 comentarios


WKDU TRBD
WKDU TRBD
06 ene

代发外链 提权重点击找我;

谷歌蜘蛛池 谷歌蜘蛛池;

Fortune Tiger…

Fortune Tiger…

谷歌权重提升/ 谷歌权重提升;

谷歌seo 谷歌seo;

谷歌霸屏 谷歌霸屏

蜘蛛池 蜘蛛池

谷歌快排 谷歌快排

Google外链 Google外链

谷歌留痕 谷歌留痕

Gái Gọi…

Gái Gọi…

Dịch Vụ…

谷歌霸屏 谷歌霸屏

负面删除 负面删除

币圈推广 币圈推广

Google权重提升 Google权重提升

Google外链 Google外链

google留痕 google留痕

Me gusta

BFVY IRTO
BFVY IRTO
28 dic 2024

代发外链 提权重点击找我;

游戏推广 游戏推广;

Fortune Tiger Fortune Tiger;

Fortune Tiger Slots Fortune…

谷歌马甲包/ 谷歌马甲包;

谷歌霸屏 谷歌霸屏;

מכונות ETPU מכונות ETPU;

;ماكينات اي تي بي…

آلات إي بي بي…

ETPU maşınları ETPU maşınları;

ETPUマシン ETPUマシン;

ETPU 기계 ETPU 기계;

Me gusta

WKDU TRBD
WKDU TRBD
28 dic 2024

代发外链 提权重点击找我;

谷歌蜘蛛池 谷歌蜘蛛池;

Fortune Tiger Fortune Tiger;

Fortune Tiger Slots Fortune…

谷歌权重提升/ 谷歌权重提升;

谷歌seo 谷歌seo;

מכונות ETPU מכונות ETPU;

Машини ETPU Машини ETPU

ETPU-Maschinen ETPU-Maschinen

EPS-машины EPS-машины

ЭПП-машины ЭПП-машины� بي يو

ETPU maşınları ETPU maşınları

ETPUマシン ETPUマシン

ETPU 기계 ETPU 기계

Me gusta

AVXJ KAZD
AVXJ KAZD
26 dic 2024

代发外链 提权重点击找我;

google留痕 google留痕;

Fortune Tiger Fortune Tiger;

Fortune Tiger Fortune Tiger;

Fortune Tiger Slots Fortune…

站群/ 站群;

万事达U卡办理 万事达U卡办理;

VISA银联U卡办理 VISA银联U卡办理;

U卡办理 U卡办理;

万事达U卡办理 万事达U卡办理;

VISA银联U卡办理 VISA银联U卡办理;

U卡办理 U卡办理;

온라인 슬롯 온라인 슬롯;

온라인카지노 온라인카지노;

바카라사이트 바카라사이트;

EPS Machine EPS Machine;

EPS Machine EPS Machine;

EPS Machine EPS Machine;

EPS Machine EPS Machine;

Me gusta
bottom of page