Q: How can I send email that includes the form data file and also allow form field data to be customizable for the subject line?

A: PDF Studio supports using submitForm as a Javascript action to send form data by email. The form data is sent as an attachment. Below is an example showing a button with submitForm action and a text field to be sent as email subject.

1. Create a Push Button and a Text field (change the name to MyTextField)

fields

2. Right click on the Button -> Properties -> select Actions

3.  Select Add -> select JavaScript action from “Action” list

4. Copy and paste the following code. This will send the form data as as an fdf file, which is the default format:

var customSubject = this.getField("MyTextField").value;
var mailtoUrl = "mailto:studiosupport@qoppa.com?subject=" + customSubject;
this.submitForm({
 cURL: mailtoUrl
});

To send the form data as an xfdf file (xml file) instead of an fdf file, use the code below:

var customSubject = this.getField("MyTextField").value;
var mailtoUrl = "mailto:studiosupport@qoppa.com?subject=" + customSubject;
this.submitForm({
 cURL: mailtoUrl, cSubmitAs: "XFDF"
});

To send as an PDF file, use the code below:

var customSubject = this.getField("MyTextField").value; 
var mailtoUrl = "mailto:studiosupport@qoppa.com?subject=" + customSubject; 
this.submitForm({ 
 cURL: mailtoUrl, cSubmitAs: "PDF" });

OR

var customSubject = this.getField("MyTextField").value;
var mailtoUrl = "mailto:studiosupport@qoppa.com?subject=" + customSubject;
this.submitForm({
 cURL: mailtoUrl, bPDF:true
});

5. Change email address, subject and body to contain the information you wish to see.
6. Click OK to apply the save the JavaScript action.

When you click on the button, PDF Studio will ask permission and then open the mail application with the subject, body specified above and the form data as an attachment. Make sure your email application has been configured correctly. You can refer to our knowledge base entry to change default email application.

prompt

email