I have an use case where PDF form is downloaded from IIS / MVC, filled by end user and submitted back to server. After successful submit FDF response triggers document protection to disallow changes to document. Protection is activated by folder level javascript function:
function applySecurity()
{
var DoApplyMySecurity = app.trustedFunction( function(){
var oMyPolicy = null;
app.beginPriv();
// First, Get the ID of My Security Policy
var aPols = security.getSecurityPolicies()
for(var index=0;index<aPols.length;index++){
if(aPols[index].name == "AgreementPolicy"){
oMyPolicy = aPols[index]; break;
}
}
if(oMyPolicy == null){ app.alert("Policy Not Found"); return; }
// Now, Apply the security Policy
var rtn = this.encryptUsingPolicy({oPolicy: oMyPolicy });
if(rtn.errorCode != 0) app.alert("Security Error: " + rtn.errorText);
app.endPriv();
});
DoApplyMySecurity();
}
Document level function calls the above function as follows:
function valuesSaved(msg)
{
app.alert(msg);
applySecurity();
app.execMenuItem("Save");
app.execMenuItem("Close");
}
The problem is that when submitting the form using Acrobat Reader DC the following error occurs:
NotAllowedError: Security settings prevent access to this property or method. Security.getSecurityPolicies:7:Doc undefined:Exec
When using Acrobat Pro DC security is applied successfully. I have exported security settings from Pro DC to Reader DC. What I am missing here?
I think this is the intention - Reader verion cannot by default save changed PDF