Skip to main content
July 5, 2016
Answered

this.saveAsText button Adobe Reader

  • July 5, 2016
  • 1 reply
  • 1112 views

Background Information

I am using Acrobat Reader DC and Adobe Acrobat XI Pro on Windows 7.

The Problem

I have an adobe form with several text fields. I would like to add a button to this form that exports the field data into a .txt file. To that end, I have placed this code in a folder level Javascript at the path "C:\Program Files (x86)\Adobe\Acrobat Reader 2015\Reader\Javascripts" :

var exportTrial = app.trustedFunction(function(){

  app.beginPriv();

  this.exportAsText();

  app.endPriv();

});

I added a button to my form and set the action to "Run A Javascript" with

exportTrial();

as the code.

I extended rights (I believe) using File>Save As Other>Reader Extended PDF>Enable More Tools (Includes form fill-in and save).

When the form is opened in Adobe Reader, the button is visible, but when it is pushed, the console displays the following error message:

NotAllowedError: Security settings prevent access to this property or method.

Doc.exportAsText:3:Field Button:Mouse Up

As I understand it, the code I have should pop a "Save As" type dialogue box for the user to choose where to place the output file. I will eventually use the cPath argument to skip this step, but I need to get the basics working first.

If anyone can see a step I missed in this process or if you can shed some light on permission issues I may have, I would be grateful.

This topic has been closed for replies.
Correct answer try67

To use this method in Reader a special Form Right has to be applied to the

file, and it can't be done with Acrobat, but with one of the LiveCycle

server applications, which are extremely expensive.

On Tue, Jul 5, 2016 at 11:08 PM, zacht17160615 <forums_noreply@adobe.com>

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 5, 2016

To use this method in Reader a special Form Right has to be applied to the

file, and it can't be done with Acrobat, but with one of the LiveCycle

server applications, which are extremely expensive.

On Tue, Jul 5, 2016 at 11:08 PM, zacht17160615 <forums_noreply@adobe.com>

July 5, 2016

Is it possible to export the data in some other way? Maybe a different format?

try67
Community Expert
Community Expert
July 5, 2016

Kind of. You can display the data as plain text which the user can then copy.

See this tool I've developed that does just that: Custom-made Adobe Scripts: Adobe Reader -- Import/Export PDF Form Data