Copy link to clipboard
Copied
Hey guys, I've got a bit of a weird bug that is driving me completely insane.
I have a form that checks if PDF is being opened in something other than Acrobat using "if(this.external){"
Until recently, this worked perfectly. If the form was opened in Chrome or something else, an error would pop up and the form fields would stay hidden.
However, sometime between July and now, this stopped working, but only when the forms are digitally signed.
Reproduction:
1) Document-level script executes "if(this.external){//unhide form fields}" on document open.
2) User fills form and uses digital signature field to sign.
3) User emails form to my team.
4) My team opens the form and "//unhide form fields" doesn't execute, with this error in the console:
"InvalidGetError: Get not possible, invalid or unknown.
Doc.external:3:Document-Level:zOpenDoc"
In my testing, I found that removing the "this.external" check would also result in an error when the script got to the "this.delay = true" line, however "this.dirty = false" works fine.
I'm beyond frustrated and confused dealing with this. Is this a genuine bug with Acrobat or is this a coding error on my part?
I would greatly appreciate any help that points me in the right direction.
Copy link to clipboard
Copied
You need to ask the developers of the Chrome PDF plugin... It has nothing to do with Adobe.
Copy link to clipboard
Copied
Apologies for being unclear.
The issue is happening in Adobe Acrobat Professional DC version 21.005.20060
Chrome is the reason that I need the code.
Copy link to clipboard
Copied
Does you get the error when you open the form in Adobe Acrobat?
Copy link to clipboard
Copied
Also, post your full code, please.
Copy link to clipboard
Copied
if(this.external){
app.alert({
cMsg: "This form does not work in your chosen PDF viewer. Please use Adobe Reader or Adobe Acrobat.",
nIcon: 0,
nType: 0,
cTitle: "Bad PDF Viewer"});
} else { //Unlock the Status field and process
this.delay = true;
actionSetVis("Show"); //Function that adjusts visibility of form fields
getField("Status").readonly = false;
switchStatus();
if(getField("Admin.Customize") == null & & getField("Admin.Save") != null){this.removeField("Admin.Save");}
this.delay = false;
this.dirty = false;
};
Here's the code in the script zDocOpen. It should execute on document open. When digitally signed, it fails.
Copy link to clipboard
Copied
What's throwing the error is not the usage of the external property. It's you trying to change the visibility of fields, which is not allowed in a signed document.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
If you don't lock the fields with the signature then you can edit them, yes, but your code does a bunch of other things, too, and one of them might not be allowed...
Copy link to clipboard
Copied
Additional note: Changing "this.external" to "false" causes a different error:
GeneralError: Operation failed.
Doc.delay:10:Document-Level:zDocOpen
Which is related to the "this.delay = true"
Copy link to clipboard
Copied
You can't set the external property as false. It's a read-only property.
Copy link to clipboard
Copied
Let me rephrase. In the above code, if you remove "this.external" and replace it with "false" so it skips the IF statement, then you get the error listed.