if (app.viewerVersion < 10) {
app.addMenuItem({ cName: "Add page info", cUser: "Add page info", cParent: "Tools", cExec: "AddInfoClass()",
cEnable: "event.rc = (event.target != null);"});
} else {
app.addToolButton({ cName: "Add page info", cLabel: "Add page info", cExec: "AddInfoClass()",
cEnable: "event.rc = (event.target != null);"});
}
AddInfoClass = app.trustedFunction(function(){
app.beginPriv();
for (var p = 0; p < this.numPages; p++) {
var txt = this.getPageLabel(p);
var aRect = this.getPageBox("Trim",p);
var width = aRect[2] - aRect[0];
var height = aRect[1] - aRect[3];
console.println(aRect);
var annot = this.addAnnot ({ page: p,
type: "FreeText",
rect: [aRect[0]+width/2,aRect[1]-5,aRect[0]+width/2+120, aRect[1]-40],
fillColor: color.transparent,
// textSize: 10,
width:0
// strokeColor: color.black,
// contents:
});
var spans = new Array();
spans[0] = new Object();
spans[0].text = txt;
spans[0].textColor = color.ltGray;
spans[0].textSize = 10;
annot.richContents = spans;
}
app.endPriv();
return;
}
)