Skip to main content
Participant
July 15, 2016
Answered

What is the correct syntax to put a PDF form file name into the Subject line of a mail.Doc Javascript?

  • July 15, 2016
  • 1 reply
  • 861 views

The file name is not part of any field in the form. The file name will also be unique each time the form is used. I also want the file name to be followed by the phrase "proof returned by client", as in:

Subject: Papa Murphys SALEM 8-30.pdf proof returned by client

Here is my existing script, but I need to know the syntax to get the PDF file name added in the Subject line.

this.mailDoc({bUI: true, cTo: "sgeist@mailboxmerchants.com", cSubject: "proof returned by client",  cMsg: "Attached is the signed proof. Please forward to the graphics dept"});

I am not very familiar with Javascript so have been trying to piece this together.

This topic has been closed for replies.
Correct answer Karl Heinz Kremer

Unfortunately, there is only so much you can google to get a working solution, I would suggest that you get at least somewhat familiar with JavaScript (there are a lot of good tutorials and books available). If you want an introduction into Acrobat's JavaScript, take a look here: Beginning JavaScript for Adobe Acrobat

There is a property of the document object that returns the filename. You can read about the Doc.documentFileName property here: Acrobat DC SDK Documentation

In the most simple implementation, you can use this to get the filename into the subject line:

this.mailDoc({bUI: true, cTo: "sgeist@mailboxmerchants.com", cSubject: this.documentFileName,  cMsg: "Attached is the signed proof. Please forward to the graphics dept"});

If you want to add more information than just the filename, you will have to assemble your subject line by using string constants and variable elements. Something like this will work:

this.mailDoc({bUI: true, cTo: "sgeist@mailboxmerchants.com", cSubject: "The filename is " + this.documentFileName,  cMsg: "Attached is the signed proof. Please forward to the graphics dept"});

1 reply

Karl Heinz  Kremer
Community Expert
Karl Heinz KremerCommunity ExpertCorrect answer
Community Expert
July 15, 2016

Unfortunately, there is only so much you can google to get a working solution, I would suggest that you get at least somewhat familiar with JavaScript (there are a lot of good tutorials and books available). If you want an introduction into Acrobat's JavaScript, take a look here: Beginning JavaScript for Adobe Acrobat

There is a property of the document object that returns the filename. You can read about the Doc.documentFileName property here: Acrobat DC SDK Documentation

In the most simple implementation, you can use this to get the filename into the subject line:

this.mailDoc({bUI: true, cTo: "sgeist@mailboxmerchants.com", cSubject: this.documentFileName,  cMsg: "Attached is the signed proof. Please forward to the graphics dept"});

If you want to add more information than just the filename, you will have to assemble your subject line by using string constants and variable elements. Something like this will work:

this.mailDoc({bUI: true, cTo: "sgeist@mailboxmerchants.com", cSubject: "The filename is " + this.documentFileName,  cMsg: "Attached is the signed proof. Please forward to the graphics dept"});

Participant
July 15, 2016

Thanks to Karl Heinz Kremer for supplying the correct answer. Unfortunately I was unable to "mark this answer as correct" in the Forum because there was no green "Correct" below the answer to click on, as suggested. Hopefully Karl still gets the credit.