简体   繁体   中英

Adobe folder level JS runs on Acrobat Pro DC but not allowed on Acrobat Reader DC

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?

我认为这是目的-默认情况下,阅读器版本无法保存更改的PDF

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM