Ok, so I have a problem with a java script for an adobe acrobat batch process.
The script takes the file name (example file name: D01MA001401_01.01_0500_p.pdf) and puts it in a text box in the bottom right corner of the document. However, it doesn't always use the same font, font size or font color, it depends on the version of adobe you're using. Acrobat 7 is the only one that uses this script correctly as it was written for that version. Acrobat 9 must require a significantly different script as it puts in red, 12 point text.
Also, I think the end result also depends on what version of adobe last opened the document. I just processed a batch with version 7 that were last opened with version 9, the script used Arial in the text box. It's very annoying.
The code is below, any ideas on how I can fix it? According to our QC it has to use Times New Roman, black, font size 9.
I would like the code to work with all versions of Acrobat but I'm not sure if that's possible. I am using version 7.1.0 pro.
/* Add code and filename */
var fnprep = this.documentFileName;
var fnlen = fnprep.length - 4;
var fnchpos = fnprep.length - 5;
var fnchar = fnprep.substring(fnchpos, fnlen);
console.println(fnchar);
var filename =" ";
filename += "200-1";
if (fnchar == "a") { filename += "e"} else{filename += "f"};
filename += "\n";
filename += fnprep.substring(0,fnlen);
var aRect = this.getPageBox( {nPage: 0} );
aRect[0] = aRect[2]-144;
aRect[1] = aRect[3]+36;
aRect[2] -= 18;
aRect[3] += 10;
var f = this.addAnnot ({
page: 0,
type: "FreeText",
rect: aRect,
textFont: "TimesNewRoman",
strokeColor: color.black,
fillColor: color.white,
textSize: 9,
contents: filename,
width: 0
});
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com