Q: How can I add a button to a PDF form that will send the form as attachment by email with a custom email subject?

A: PDF Studio supports using submitForm as a Javascript action to send the current PDF form by email. Below is an example showing a button with submitForm action and a text field to be sent as email subject. The text field could contain for instance a unique identifier for the data contained in the form, such as the customer name, social security number, or a patient insurance ID which will be sent as the subject of the email.

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.

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. e sure your email application has been configured correctly. You can refer to our knowledge base entry to change default email application.

prompt