Rights-Enabled PDF Files
Writing Acrobat JavaScript for Reader
13
When you invoke the object’s
encryptForRecipients
method, the
oGroups
parameter is an array of
Group
objects, each of which contains a
permissions
property.
The
permissions
property is an object containing the properties described below in
Table 13.3:
T
ABLE
13.3
Permissions Object
Property
Description
Full, unrestricted access
Content access for the visually impaired
content copying and extraction
Allowed changes (
none
,
documentAssembly
,
fillAndSign
,
editNotesFillAndSign
,
all
)
Printing security level (
none
,
lowQuality
,
highQuality
)
allowAll
allowAccessibility
allowContentExtraction
allowChanges
allowPrinting
The following code allows full and unrestricted access to the entire document for one set of
users (
importantUsers
), and allows high quality printing for another set of users
(
otherUsers
):
// Obtain the security handler:
var sh = security.getHandler("Adobe.PPKMS");
// Connect to the directory containing the user certificates:
var dir = sh.directories[0];
var dc = dir.connect();
// Search the directory for certificates:
dc.setOutputFields({oFields:["certificates"]});
var importantUsers = dc.search({oParams:{lastName:"Smith"}});
var otherUsers = dc.search({oParams:{lastName:"Jones"}});
// Allow important users full, unrestricted access:
var importantGroup = {
oCerts: importantUsers,
oPermissions: {allowAll: true}
};
// Allow other users high quality printing:
var otherGroup = {
oCerts: otherUsers,
oPermissions: {allowPrinting: "highQuality"}
};
Acrobat JavaScript Scripting Guide
231