PDF分页的JavaScript 脚本

arr = new Array(
//这里加入页号-------------
1,3,5,7,9
//-------------------------
);

//var re = /.*\/|\.pdf$/ig;
//var filename = this.path.replace(re,"");

var re = /\.pdf$/ig;
var filepath = this.path.replace(re,"") + "_";

var si=0;
var ei=0;
for(var i=0; i < arr.length; i++){
  si = arr[i];
  if(i==arr.length-1){
    ei = this.numPages;
  }else{
    ei = arr[i+1]-1;
  }

  try
  {
    this.extractPages
    ({
      nStart: si-1,
      nEnd: ei-1,
      cPath: filepath + si + ".pdf"
    });
  }
  catch(e)
  {
    console.println("Err:"+e)
  }
}

原文地址:https://www.cnblogs.com/del/p/969757.html