A
A Short Acrobat JavaScript FAQ
How can I make restricted Acrobat JavaScript methods available to users?
The following example shows the addition of dates.
/* Example of date arithmetic. */
/* Create a date object containing the current date. */
var d1 = new Date();
/* num contains the numeric representation of the current date. */
var num = d1.valueOf();
/* Add thirteen days to today’s date, in milliseconds. */
/* 1000 ms/sec, 60 sec/min, 60 min/hour, 24 hours/day, 13 days */
num += 1000 * 60 * 60 * 24 * 13;
/* Create our new date, 13 days ahead of the current date. */
var d2 = new Date(num);
/* Print out the current date and our new date using util.printd */
console.println("It is currently: "
+ util.printd("mm/dd/yyyy", d1));
console.println("In 13 days, it will be: "
+ util.printd("mm/dd/yyyy", d2));
The output of this script would look something like:
It is currently: 01/15/1999
In 13 days, it will be: 01/28/1999
How can I make restricted Acrobat JavaScript methods available to
users?
Many of the methods in Acrobat JavaScript are restricted for security reasons, and their
execution is only allowed during batch, console or menu events. The
Acrobat JavaScript
Scripting Reference
identifies these methods by a padlock symbol in the quick bar. This
restriction is a limitation when enterprise customers try to develop solutions that require
these methods and know that their environment is secure.
Three requirements must be met to make restricted Acrobat JavaScript methods available
to users.
●
●
You must obtain a digital ID.
You must sign the PDF document containing the restricted JavaScript methods using
the digital ID.
For details on where you can obtain digital IDs and the procedures for using them to
sign documents, see Acrobat Help.
The recipient should trust the signer for certified documents and JavaScript.
For details, see Acrobat Help.
●
All trusted certificates can be accessed by selecting Certificates from
Advanced > Manage
Digital IDs > Trusted Identities
in Acrobat’s main menu.
266
Acrobat JavaScript Scripting Guide