14
votes

I have created a form in Acrobat that includes a submit button. When the user clicks it I want certain fields to be exported as tab delimited text. In Acrobat, when the button is clicked the window opens, allowing me to select the folder to export into, and the data is exported. In reader nothing happens. The debugger gives me this error:

RangeError: Invalid argument value.
Doc.exportAsText:2:Field Submit:Mouse Up

I've looked and can't seem to find information on this error. My original script is this:

var aSubmitFields = new Array ( "Name", "Address")
this.exportAsText ({aFields: aSubmitFields})

As you can see it's very basic. I don't understand why it will not work.

EDIT: after removing the "a" from ({aFields I get the error:

NotAllowedError: Security settings prevent access to this property or method.
Doc.exportAsText:2:Field Submit:Mouse Up
2
You need to allow Advanced Forms Features rights. help.adobe.com/en_US/acrobat/X/standard/using/… - Ilya Kharlamov
Did you solve this problem in the end? - w5m
The Wayback machine archived that link from @IlyaKharlamov web.archive.org/web/20130214082334/http://help.adobe.com/en_US/… - Fuhrmanator

2 Answers

2
votes

To achieve this in Acrobat Reader first user will open tools>preferences, there user will see the security settings. Here first need to allow active contents to run

After doing this your code should work, the active contents like JavaScript are exploited by malicious users so this feature is disabled by default.

New versions with HotFix installed will not allow JavaScript, every time security hot fix applied it will disable the JavaScript/Active Content option..

I hope this will give you some insights towards solution..

1
votes

To be able to call exportAsText() in Adobe Reader you need to have "Advanced Forms Features rights" on document. You can see it in documentation pages 32 and 251. If you do not have this right on document you are calling JavaScript code on you will get "Security settings prevent access to this property or method." error.

This rights can be set when the document is created in Adobe Acrobat.

And the active content must be allowed in reader as the MarmiK already tell you.