Skip to main content
Participating Frequently
Apr 15, 2024 9:19 PM UTC
Answered

Print form as PDF and attach to email button?

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});

try67
try67Correct answer
Community Expert
Apr 20, 2025 10:01 AM UTC

Use this:

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

11 replies

Participant
Apr 20, 2025 9:34 AM UTC

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

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Apr 20, 2025 10:01 AM UTC

Use this:

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

Translate
Thom Parker
Community Expert
Community Expert
Apr 15, 2024 9:33 PM UTC

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.  

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
Apr 16, 2024 5:09 PM UTC

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?

Translate
try67
Community Expert
Community Expert
Apr 15, 2024 9:32 PM UTC

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

Translate
Participating Frequently
Apr 16, 2024 5:07 PM UTC

only using acrobat, sent via outlook

Translate
try67
Community Expert
Community Expert
Apr 16, 2024 5:09 PM UTC

Before the mailDoc command, add this line:

this.flattenPages();

Translate