Skip to main content
Known Participant
September 14, 2021
Question

Using "this.external" throws "InvalidGetError" when file is digitally signed

  • September 14, 2021
  • 2 replies
  • 940 views

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.

This topic has been closed for replies.

2 replies

Known Participant
September 15, 2021
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. 

try67
Community Expert
September 15, 2021

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.

Known Participant
September 15, 2021

I just tested that and that does not seem to be the case.
The attached file unhides a field On Open and then hides again On Save. Signed or not, it does not appear to throw any errors. 

try67
Community Expert
September 15, 2021

You need to ask the developers of the Chrome PDF plugin... It has nothing to do with Adobe.

Known Participant
September 15, 2021

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. 

Bernd Alheit
Community Expert
September 15, 2021

Does you get the error when you open the form in Adobe Acrobat?