Security
Adding Security to PDF Documents
12
Adding Security to Document Attachments
You may add security to a document by encrypting its attachments and enclosing them in
an
eEnvelope.
To do this with Acrobat JavaScript, invoke the
doc
object’s
addRecipientListCryptFilter
method, which is used to encrypt data objects and
accepts two parameters:
●
●
oCryptFilter
: the name of the encryption filter
oGroup
: an array of
Group
objects representing the intended recipients
Thus, an eEnvelope is a PDF file that contains encrypted attachments. The name of the
crypt filter, which represents the recipient list, is defined and used when importing the
attachment. An example is given below:
// Create instructions to be used in the recipient dialog:
var note = "Select the recipients. Each must have ";
note += "an email address and a certificate.";
// Specify the remaining options used in the recipient dialog:
var options = {
bAllowPermGroups: false,
cNote: note,
bRequireEmail: true
};
// Obtain the intended recipient Group objects:
var groupArray = security.chooseRecipientsDialog(options);
// Open the eEnvelope document:
var env = app.openDoc("/C/myeEnvelope.pdf");
// Set up the crypt filter:
env.addRecipientListCryptFilter("myFilter", groupArray);
// Attach the current document to the eEnvelope:
env.importDataObject("secureMail0", this.path, "myFilter");
// Save the eEnvelope:
env.saveAs("/C/outmail.pdf");
Acrobat JavaScript Scripting Guide
217