12
Security
Adding Security to PDF Documents
var annot = this.addAnnot({
page: 0,
type: "Stamp",
author: "A.C. Robat",
rect: [400, 400, 550, 500],
contents: "This is good."
AP: "Approved"
});
Setting Digital Signature Preferences
When applying digital signatures, you may specify the appearance and the default signing
method. In addition, you may set the
security
object’s
validateSignaturesOnOpen
property to verify signatures whenever the document is
opened, and set up policies that examine the signature information. Signature information
may be obtained by invoking the signature field’s
signatureInfo
method. At this point
you can customize the behavior based on the information found within the
signatureInfo
object.
The following example illustrates how to access the signature information:
// Obtain the signature field:
var f = this.getField("mySignatureField");
// Validate the signature field:
var status = f.signatureValidate();
// Obtain the signature information
var sigInfo = f.signatureInfo();
console.println("Name: "
console.println("Reason:
console.println("Date: "
console.println("Contact
+ sigInfo.name);
" + sigInfo.reason);
+ sigInfo.date);
Info: " + sigInfo.contactInfo);
Adding Security to PDF Documents
Adding Passwords and Setting Security Options
Since the
Standard
security handler, used for password encryption of documents, is not
JavaScript-enabled, the most direct way to add passwords is through the creation of user or
master passwords in the Acrobat user interface.
As you learned earlier in
Encrypting Files Using Certificates,
you may encrypt a document
for a number of recipients using certificates, and can set security policies through the
210
Acrobat JavaScript Scripting Guide