Auto populate a PDF with current year to next year using Javascript
is it possible to auto populate a PDF with the last 2 digits 20__ - 20__ with current year to next year every time I open up a PDF page? example 2017-2018?
is it possible to auto populate a PDF with the last 2 digits 20__ - 20__ with current year to next year every time I open up a PDF page? example 2017-2018?
That didn't work...
I have this JavaScript on Page Properties:
var f = this.getField("Today");
f.value = util.printd("yy", new Date());
so when the page pull up "20__ to 20__" comes up auto populated as "2017 to 20__".
Any way to add another script onto the above so it will show 2017 to 2018?
You need to add another field and then increment the year value by 1.
A possible script is:
var f = this.getField("Today");
f.value = util.printd("yy", new Date());
f = this.getField("NextYear");
f.value = Number(util.printd("yy", new Date())) + 1;
For this to work one needs to be careful about the type of variables, that is , there is a significant difference between a String variable and a Number variable and how the "+" operator works.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.