Skip to main content
Inspiring
Jan 8, 2019 2:01 PM UTC
Answered

Close form and export data as csv with button

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 is closed to new replies. Start a new post to keep the conversation going.
Thom Parker
Thom ParkerCorrect answer
Community Expert
Jan 8, 2019 6:11 PM UTC

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

5 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
Jan 8, 2019 6:11 PM UTC

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.

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
jd44Author
Inspiring
Jan 9, 2019 5:49 PM UTC

Great information! Thank you!

Translate
try67
Community Expert
Community Expert
Jan 8, 2019 2:20 PM UTC

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

Translate
jd44Author
Inspiring
Jan 8, 2019 3:05 PM UTC

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

Thanks!

Translate
try67
Community Expert
Community Expert
Jan 8, 2019 3:31 PM UTC

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

Translate