Mr. Reinhardf Im using your script and I will like to change the code a little bit in order to get just some parts of the path,
Ex. my actual path is something like /1/2/3/4/5/abc.pdf and will like to change the footer to something like 4/5/abc.
1/2/3 will be always the same part of the path; all documents are in the same drive.
I know I need to change this part of you code
var re =/.*\/|\.pdf$/ig;
var FileNM = this.path.replace(re,"")+".pdf";
var Path = this.path;
But I can’t get what I want.
Any help will be appreciated
I have modified Java Script. This is to make footer as the bookmark name of each pages(only applies 1st level bookmarks). I use this script when I merge many files into one PDF.
Please see below:
=======================
app.addSubMenu({ cName: "BMKFooter",cUser: "BookMark Footer", cParent: "File", nPos: 21 });
app.addMenuItem({ cName: "Set", cParent: "BMKFooter", cExec: "SetFooter(9)"});
app.addMenuItem({ cName: "-------------------------------", cParent: "BMKFooter",cExec: "{}"});
app.addMenuItem({ cName: "Remove", cParent: "BMKFooter", cExec: "RemoveFooter(9)"});
//Set/remove Footer
function SetFooter(ARG)
{
var bmk = this.bookmarkRoot;
var BMKName;
var lastBMKPage=0;
var currentBMKPage=0;
var p=0;
if(bmk.children != null){
for(var i = 0; i < bmk.children.length; i++){
BMKName=bmk.children[i].name;
if(i<=bmk.children.length-2){
bmk.children[i+1].execute();
lastBMKPage = this.pageNum-1; }
else {lastBMKPage = this.numPages -1;}
for ( p = currentBMKPage; p <= lastBMKPage; p++){
var aRect = this.getPageBox("Crop",p);
var TotWidth = aRect[2] - aRect[0]
if (ARG==9)
{var fd = this.addField(String("xftDate"+p+1), "text", p, [30+TotWidth/2,15, TotWidth-30,40]);
fd.value = " " + BMKName +" "; //print bookmark name
fd.textSize=10; fd.readonly = true;
fd.alignment="right";
}
}
currentBMKPage = lastBMKPage +1;
}
}}
function RemoveFooter(ARG)
{
if (ARG==9)
{for (var p = 0; p < this.numPages; p++)
{var x = this.removeField(String("xftDate"+p+1));}
}
//if (ARG==9)
//{ for (var p = 0; p < this.numPages; p++)
//{var x = this.removeField(String("xftPage"+p+1)); }
//if (ARG<=3 || ARG==9) {var x = this.removeField("xftRem");}
//}
}
==========================
This is very late response. But I hope this is helpful for you.
North America
Europe, Middle East and Africa
Asia Pacific