Security
Adding Security to PDF Documents
12
application of an author signature accompanied by the desired modification, detection,
and prevention settings shown above in
Table 12.1.
Adding Usage Rights to a Document
You may decide which usage rights will be permitted for a set of users. You may specify
either full, unrestricted access to the document, or rights that address accessibility, content
extraction, allowing changes, and printing. You may use Acrobat JavaScript to customize
these rights when encrypting a document for a list of recipients. For more information, see
Encrypting PDF Files for a List of Recipients
As you have seen throughout this chapter, the
doc
object’s
encryptForRecipients
method is the primary means of encrypting PDF files for a list of recipients using Acrobat
JavaScript. In the previous example, the certificates used were gathered by connecting to a
directory
, which is a repository of user information. The
directory
object contains
an
info
property with which it is possible to create and activate a new directory, and is
accessible either through the
directories
property or the
newDirectory
method of
the
securityHandler
object.
The
info
object is a
DirectoryInformation
object, which may contain standard
properties related to the name of the directory, as well as additional properties specific to a
particular directory handler (these may include server and port information).
To create a new directory, create a
DirectoryInformation
object, obtain a
securityHandler
object and invoke its
newDirectory
method, and assign the
DirectoryInformation
object to the new directory’s
info
property. An example of
this is given below:
// Create and activate a new directory:
var newDirInfo = {
dirStdEntryID: "dir0",
dirStdEntryName: "Employee LDAP Directory",
dirStdEntryPrefDirHandlerID: "Adobe.PPKMS.ADSI",
dirStdEntryDirType: "LDAP",
server: "ldap0.acme.com",
port: 389
};
// Obtain the security handler:
var sh = security.getHandler("Adobe.PPKMS");
// Create the new directory object:
var newDir = sh.newDirectory();
// Store the directory information in the new directory:
newDir.info = newDirInfo;
Acrobat JavaScript Scripting Guide
211