Skip to main content
ocdriveshafts
Participant
August 29, 2017
Question

Mouse up run javascript importTextData

  • August 29, 2017
  • 2 replies
  • 709 views

I am trying to get a form to auto fill from a tab delimited text file when a button is clicked.

I have a Mouse up triggered run JavaScript that is running

this.importTextData("/c/Users/username/Desktop/filename.txt", 0)

When I manually enter the data through Manage form data > Import data it accepts the data just fine so I know the file works I just want to make it so it can be run with just the button.

What am I missing?

This topic has been closed for replies.

2 replies

Joel Geraci
Community Expert
Community Expert
August 29, 2017

You're missing the phrase in the documentation after the word "Note:"

Acrobat DC SDK Documentation

Note: (Acrobat 8.0) If cPath is specified, this method can only be executed during batch and console events.

You won't be able to execute the code from a button unless you place the file in a privileged location. You can either follow the directions in the answer above or have each user create a special folder and then tell their version of Reader/Acrobat that it's privileged in the Security Enhanced section of the preferences..

J-

Inspiring
August 29, 2017

You're missing the security restrictions that are in place for this method. In order to trigger it from document, you'll have to place the appropriate code in a document-level JavaScript file. This means that each user will have to install a document-level JavaScript file. More information here: https://acrobatusers.com/tutorials/getting-external-data-into-acrobat-x-javascript