12
Security
Adding Security to PDF Documents
The
doc
object’s
encryptForAPS
method accepts four parameters:
●
●
●
●
cPolicyID
: the policy ID to use when encrypting the document
bUI
: determines whether the user interface is shown when authenticating
oHandler
: the handler to use when applying the policy
aRecipients
: an array of email addresses for the intended recipients (used only if the
template policy ID is
adobe_secure_for_recipients
In the following example, a newly created document is encrypted using the template
policy:
// Obtain the APS security handler:
var aps = security.getHandler("Adobe.APS");
// Access the digital ID:
aps.login({
oParams: {
cURI: "http://adobe.com/guardian",
cUserId: "test",
cPassword: "test"
}
});
// Specify the recipients:
var recipients = [
"user1@adobe.com",
"user2@adobe.com",
"user3@adobe.com"
];
// Create the new document
var myDoc = app.newDoc();
// Encrypt the document:
myDoc.encryptForAPS({
cPolicyId: "adobe_secure_for_recipients",
aRecipients: recipients,
oHandler: aps,
bUI: false
});
216
Acrobat JavaScript Scripting Guide