Skip to main content
Participating Frequently
April 15, 2024
Answered

Print form as PDF and attach to email button?

  • April 15, 2024
  • 3 replies
  • 2178 views

Hello, i did a quick search but wasnt satisfied with the language i found regarding my question.

 

I have a fillable form i wish to send with email via a button on the form using javascript.

 

When i do this now, acrobat attaches a live fillable file, and not a printed pdf.

 

This is for a class certificate, and must be sent as a printed pdf and not the editable form.

Can someone please help provide the java code to accomplish this? Its more complex than i can work out on my own.

Thanks for the assistance!

 


var cToAddr = "email@address.here"


var cSubLine = "Your Certificate of Achievement"


var cBody = "Thank you for your recent participation at our Continuing Education Session.\r" + "Your Certificate of Achievement is enclosed.\r \r" + "If you have any questions, please do not hesitate to reach us."

 

this.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody});

Correct answer try67

Use this:

this.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody, cCc: "me@server.com" });

3 replies

Participant
April 20, 2025

Hi, in case I want to CC the email, how will the javascript code change? Please help me with this 

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
April 20, 2025

Use this:

this.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody, cCc: "me@server.com" });

Thom Parker
Community Expert
Community Expert
April 15, 2024

This cannot be done from a script on the form itself. 

However, if you are using Acrobat Pro, an automation script can be written to flatten the document and send it.  

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
April 16, 2024

Thanks, so i can use script for button on document that will

  1. flatten document
  2. create email and attach flattened document

 

can you help me with a sample script to try?

try67
Community Expert
Community Expert
April 15, 2024

Is the file going to be sent exclusively from Acrobat, or also from Adobe Reader, or other applications?

Participating Frequently
April 16, 2024

only using acrobat, sent via outlook

try67
Community Expert
Community Expert
April 16, 2024

Before the mailDoc command, add this line:

this.flattenPages();