Skip to main content
Inspiring
January 8, 2019
Answered

Close form and export data as csv with button

  • January 8, 2019
  • 2 replies
  • 1294 views

Hi,

I am trying to write some code on the "exit" button of a survey that will close the form and export the data as a .csv file to a location on the user's computer of their choice. The data consists of simple radio button answers, some yes / no, and some multiple choice (four possible answers).

I've been messing around but haven't found a good solution..

Is this possible?

Thanks!

This topic has been closed for replies.
Correct answer Thom Parker

Acrobat JavaScript has lots of security issues, and so it is sandboxed and simply does not provide many features, such as saving non-PDF files to the user's file system, and even that is restricted. So there is no way to use JavaScript to export a CSV file out of Acrobat to file system.

Here's an article on Acrobat trust/security:

Trust and Privilege in Acrobat Scripts

There are ways around these issues, but they all pretty much require a trust mechanism such as the folder level script mentioned by Try67, or something other than JavaScript, like an Acrobat plug-in or an external (visual basic) application that uses the IAC (interapplication communication) API, or a server script, cause you can send a csv file to a server from Acrobat.

2 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 8, 2019

Acrobat JavaScript has lots of security issues, and so it is sandboxed and simply does not provide many features, such as saving non-PDF files to the user's file system, and even that is restricted. So there is no way to use JavaScript to export a CSV file out of Acrobat to file system.

Here's an article on Acrobat trust/security:

Trust and Privilege in Acrobat Scripts

There are ways around these issues, but they all pretty much require a trust mechanism such as the folder level script mentioned by Try67, or something other than JavaScript, like an Acrobat plug-in or an external (visual basic) application that uses the IAC (interapplication communication) API, or a server script, cause you can send a csv file to a server from Acrobat.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
jd44Author
Inspiring
January 9, 2019

Great information! Thank you!

try67
Community Expert
Community Expert
January 8, 2019

Only if you can install a script on the local machine of each user.

jd44Author
Inspiring
January 8, 2019

Ok... is there a way I can at least get the document to save and close when the exit button is pushed?

Thanks!

try67
Community Expert
Community Expert
January 8, 2019

Saving the file silently also requires installing a script on the local machine.