I need to add a blank page after every fifth page so I wrote the javascript below. I want to run it as part of a batch process. It seems to choke at line 13 ( this.pageNum++ ). Has anybody have any ideas on how to fix this.
Thanks Dan
Code:
try {
var newName = this.path;
var blank = "blank.pdf";
var filename = newName.replace(".pdf","_Original.pdf");
this.saveAs(filename);
var x=1;
for(var i= 0; i <= this.numPages; i++){
if (x==5){
this.insertPages(0, blank);
x=1;
}
x++;
this.pageNum++ ;
i++;
}
}
catch(e)
{
app.alert(e);
}
From Acrobat's JavaScript Reference:
insertPages
Parameters: [nPage], cPath, [nStart], [nEnd]
Returns: Nothing
"...If nStart and nEnd are not specified, then the range of pages is for all
pages in the document...."
George Kaiser