page number and header using batch header javascript
hello,
I am trying to create a script using java for my batch header processing. I currently have a script that was given a while back but need it updated, the problem is I don't know who wrote it and I know nothing about it.
I need it formatted to show the page number in the middle (center of page) with the file name on the top right hand side of the pdf, can anyone help?
/* Top right hand corner */
/* Get the filename and trim off
the '.PDF' */
var filename = this.documentFileName
filename = Left(filename,
String(filename).length);
/* Get Start Time */
var d1 = new Date();
var pages = this.pageNum + ' of ' + this.numPages;
- this.addWatermarkFromText(
{
cText:pages,
nFontSize: 8,
nTextAlign:
app.constants.align.center,
nHorizAlign:
app.constants.align.center,
nVertAlign:
app.constants.align.top,
nHorizValue: -4, nVertValue:
-4,
bOnTop: true,
bOnScreen: true,
bOnPrint: true,
aColor:color.black
});
this.addWatermarkFromText(
{
cText:filename,
nFontSize: 8,
nTextAlign: app.constants.align.center,
nHorizAlign:
app.constants.align.right,
nVertAlign:
app.constants.align.top,
nHorizValue: -4, nVertValue:
-4,
bOnTop: true,
bOnScreen: true,
bOnPrint: true,
aColor:color.black
});
function Left(str, n)
{
if (n<=0)
return "";
else if (n > String(str).length)
return str;
else
return String(str).substring(0,22);
}
not sure if this is even right at the moment, but I need one for my headers to be aligned centered for page numbers and top right side for file name.
any help is greatly appreciated.
