Hello,
I use a script to print the print date + 1 day on a PDF document. This date appears only when the document is printed.
The script works but I get error messages that I cannot debug.
Here is the script:
/* Date Printed */
var currentTime = new Date()
currentTime.setDate(currentTime.getDate()+1);
for (var p = 0; p < this.numPages; p++)
{ var fd = this.addField("Date", "text", p, [100,10, 460,40]);
fd.textSize=12; fd.value = "UNCONTROLLED COPY - VALID UNTIL: " + util.printd("dd mmm yyyy", currentTime);
fd.allignment = "center"; fd.fillColor = color.black; fd.textColor = color.white; fd.display = display.noView;
var txtWillPrint = 'var d = this.dirty;\r'
+ 'var fd = this.getField("Date");\r'
+ 'fd.value = "UNCONTROLLED COPY - VALID UNTIL: " + '
+ 'util.printd("dd mmm yyyy", currentTime);\r'
+ 'this.dirty = d;';
this.setAction("WillPrint", txtWillPrint);
}
And the error messages:
InvalidGetError: Get not possible, invalid or unknown.
Doc.layout:7:Batch undefined:Exec
currentTime is not defined
3:Document-Actions:Document Will Print
currentTime is not defined
3:Document-Actions:Document Will Print
Thanks in advance.
Red
Or get use the parts of the date object:
George Kaiser