Skip to main content
Participant
March 5, 2025
Question

PDF form, with Java script to send a mail, and to flatten the document

  • March 5, 2025
  • 1 reply
  • 836 views

Good day Guys,

I need some advice and or assistance, i have created a simple filable form, for users to complete and submit the form to a specified email account and to cc in another email, i have also set the script to flatten the form before sending the form, so the form is not editable once the recipient receives the form.

 

the form is working perfectly on my PC using Adobe DC pro ( subscription), but once the form is shared with another user using Adobe ( non subscription) the form does not want to open the script to send the email.

 

Any advice would be apreciated

1 reply

NicoF-TTAuthor
Participant
March 5, 2025

Hi have inculed the script if this will help at all

 

// Define the target email and CC email
var targetEmail = ;
var ccEmail = "; // Replace with the desired CC email address

// Update the subject line to include "HP Warranty Collection," the Shipper Name, and the Supplier Reference Number
var subjectLine = "HP Warranty Collection: " + this.getField("Shipper Name_2").valueAsString + " - " + this.getField("Supplier Reference Number_2").valueAsString;

// Add a message for the email body
var messageBody = "Dear Team,\n\nPlease find the warranty collection details attached.\n\nThank you!";

// Flatten the form fields to make them static (non-editable)
this.flattenPages();

// Send the email with the subject and message, including the flattened form as an attachment
this.mailDoc({
cTo: targetEmail, // To email address
cCc: ccEmail, // CC email address
cSubject: subjectLine, // Subject line for the email
cMsg: messageBody // Body of the email
});

Bernd Alheit
Community Expert
Community Expert
March 5, 2025

flattenPages will not work in the free Acrobat Reader.

Bernd Alheit
Community Expert
Community Expert
March 5, 2025

Hi, Bernd, thank you for the reply, i did not know this, do you perhaps have an alternative solution for me to submit the form so that the recipient is not able to edit the same ?


Set the form fields as read-only.