Security
Adding Security to PDF Documents
12
In the following example, a newly created document is encrypted for a list of recipients,
using the
encryptUsingPolicy
method, by choosing and applying a security policy:
// Create the new document
var myDoc = app.newDoc();
// Set up the filtering options (SecurityOptionsPolicy object):
var options = {
bCheckOnline: true,
cFilter: "Adobe.APS"
};
// Choose the security policy:
var policy = security.chooseSecurityPolicy(options);
// Choose the list of recipients
var recipients = {
userEntities: [
{email: "user1@adobe.com"},
{email: "user2@adobe.com"},
{email: "user3@adobe.com"}
]
};
// Encrypt the document using the security policy:
var policyID = myDoc.encryptUsingPolicy({
cPolicyId: "adobe_secure_for_recipients",
oRecipients: [recipients]
});
// Display the policy ID:
console.println("Policy ID = " + policyID);
Acrobat JavaScript Scripting Guide
215