Highlighted

Scripting for a PDF form

Adobe Community Professional ,
Sep 08, 2020

Copy link to clipboard

Copied

Since I couldn't find the Acrobat scripting forum which used to exist, I had to post my question here.

 

I have a simple PDF form which will be filled by users. At the bottom of the form, I placed a "Send" button that will automatically attach the PDF to the email and will eventually be sent to the concerned person.

Is there a way to have the Entity Name (see image) show in the e-Mail Subject instead of having the document name?

Entity-name.jpg

 

Adobe Community Professional
Correct answer by ls_rbls | Adobe Community Professional

Acrobat SDK and JavaScript, is the right support forum for what your asking.

 

You'll probably looking into using the mailDoc() method.

 

Here's a sample script that I used to help  another user recently:

 

var cFromAddr =  this.getField("Email").value;

var cToAddr = "myemail@company.com";

var cSubLine = "I, " + this.getField("Name").value +", " + "want to buy a car from " + this.getField("Range_From").value +" range at a " + this.getField("Range_To").value +" rate." ;

var cBody = "In here is the message body which you can customize and add other text fields as shown in the subject line above." + "\n \nPlease send this email to yourself by clicking the Submit button above,  review the terms in this form and save it for your files."

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

 

I adapted the script with ideas of other users who have posted similar questions and using as a guideline the examples provided in the Adobe Acrobat SDK JavaScript API Reference,  Doc methods, page 287.

Topics

Acrobat SDK and JavaScript, PDF forms

Views

48

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Scripting for a PDF form

Adobe Community Professional ,
Sep 08, 2020

Copy link to clipboard

Copied

Since I couldn't find the Acrobat scripting forum which used to exist, I had to post my question here.

 

I have a simple PDF form which will be filled by users. At the bottom of the form, I placed a "Send" button that will automatically attach the PDF to the email and will eventually be sent to the concerned person.

Is there a way to have the Entity Name (see image) show in the e-Mail Subject instead of having the document name?

Entity-name.jpg

 

Adobe Community Professional
Correct answer by ls_rbls | Adobe Community Professional

Acrobat SDK and JavaScript, is the right support forum for what your asking.

 

You'll probably looking into using the mailDoc() method.

 

Here's a sample script that I used to help  another user recently:

 

var cFromAddr =  this.getField("Email").value;

var cToAddr = "myemail@company.com";

var cSubLine = "I, " + this.getField("Name").value +", " + "want to buy a car from " + this.getField("Range_From").value +" range at a " + this.getField("Range_To").value +" rate." ;

var cBody = "In here is the message body which you can customize and add other text fields as shown in the subject line above." + "\n \nPlease send this email to yourself by clicking the Submit button above,  review the terms in this form and save it for your files."

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

 

I adapted the script with ideas of other users who have posted similar questions and using as a guideline the examples provided in the Adobe Acrobat SDK JavaScript API Reference,  Doc methods, page 287.

Topics

Acrobat SDK and JavaScript, PDF forms

Views

49

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Sep 08, 2020

Copy link to clipboard

Copied

Acrobat SDK and JavaScript, is the right support forum for what your asking.

 

You'll probably looking into using the mailDoc() method.

 

Here's a sample script that I used to help  another user recently:

 

var cFromAddr =  this.getField("Email").value;

var cToAddr = "myemail@company.com";

var cSubLine = "I, " + this.getField("Name").value +", " + "want to buy a car from " + this.getField("Range_From").value +" range at a " + this.getField("Range_To").value +" rate." ;

var cBody = "In here is the message body which you can customize and add other text fields as shown in the subject line above." + "\n \nPlease send this email to yourself by clicking the Submit button above,  review the terms in this form and save it for your files."

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

 

I adapted the script with ideas of other users who have posted similar questions and using as a guideline the examples provided in the Adobe Acrobat SDK JavaScript API Reference,  Doc methods, page 287.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

Good day, 

Thank you so much for sharing the script with me. I sat today with my colleague, made necessary changes to your script to suit our needs.

Here is what we used at the end…

var cToAddr = "email1@domain.com";

var cCCAddr = "email2@domain.com";

var cSubLine = "True-up Request for: " + this.getField("entity_name").value + ", Ref. No.: " + this.getField("entity_reference").value;

 

var cBody = "The attached file contains data that was entered into a form. It is not the form itself." + "\n \nThe recipient of this data file should save it locally with a unique name. Adobe Acrobat Professional 7 or later can process this data by importing it back into the blank form or creating a spreadsheet from several data files. See Help in Adobe Acrobat Professional 7 or later for more details.";

 

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

 

Just to explain the script for other readers. Press the send button in the pdf form will attach the full pdf to an email for the sender.

Two-persons will receive an email that shows the following in the subject box: Entity Name, and Reference.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF