I have a working code that creates an email using information in the form fields and attaches a copy of the form to the email to be sent to the client.
I have another code that successfully flattens the form removing the non-printable buttons in preperation for a non-editable copy that we hope to submit to the client.
What I'm trying to do is figure out how to blend the two togethar where the email is created using the form field data, then the document is flattened and PDF packaged into the email as an "non-form" attachment for the client.
I have the below code but it doesn't work. I'm guessing that it doesn't work becasue the fields labels are removed due to the flattening before the part of the code that attaches it to the email is complete. Please help me develop a working code:
flattenPages(0,numPages-1,2);
this.syncAnnotScan();
annots = this.getAnnots();
for (var i = 0; i < annots.length; i++) {
annots[i].print = true;
}
// This is the form return e-mail. Its hardcoded
// so that the form is always returned to the same address
// Change address on your form
var cToAddr = this.getField("Email Address").value;
// First, get the client BCC e-mail address
var cBCCAddr = this.getField("Admin Email").value;
// Set the subject and body text for the e-mail message
var cSubLine = "Your Support Work Order";
var cBody = "Dear "
+ this.getField("Primary Site Contact").value +
",\n\n" +
"Attached you will find a PDF copy of today's work order notes for your records. As always your complete satisfaction is our #1 priority. If for any reason you feel the solution provided has not met your expectations, please let us know as all of our solutions and repairs come with a 30 day warranty as outlined in our Terms and Conditions agreement found at . \n\n" +
"You will receive an invoice including the charges from this visit sent to you and the Billing Contact on file this Friday. The invoice will be automatically paid on the following Friday through your method of payment on file. You will have 96 hours from the time the invoice is received to dispute any incorrect charges. \n\n" +
"Thank you for your business, \n\n" +
"Your Support Team \n" +
"Business Name \n" +
"Office: Number \n" +
"Fax: Number \n" +
"Email: Address";
// Send the form data as an PDF attachment on an e-mail
this.mailDoc({bUI: true, cTo: cToAddr, cBcc: cBCCAddr,
cSubject: cSubLine, cMsg: cBody});
Joseph
The logical workaround would be to write at the very beginning all the data you need after the flattening into variables, and use them.
HTH.
Max Wyss.