Skip to main content
GeorgeCFray
Known Participant
October 2, 2018
Question

Producing Code that allows me to Save As with Consecutive Numbering to the PDF THEN Send In An Email

Hi,

I'm looking to automate the name generation process within my PDF.

Essentially I wish to add a save as code the start of the below code. which reads the code within a folder, then saves as takes the next available number and opens it with the email code below

var theSubject = "ECR-X01 | " + this.getField("Dropdown3").value;

this.mailDoc({

  bUI: false,

  cTo: this.getField("Text Field 4").value,

  cCc: "sample@email.com",

  cSubject: theSubject,

  cMsg: "Hi, can you please review the attached Engineering Change Request? If you feel that this Engineering Change Request Form can be improved, please contact George Fray"

});

Thanks in advance.

(PS. the above code is working spot on!)

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

try67
Community Expert
Community Expert
October 2, 2018

You would need to install a script on the local machine of each user to do it automatically.

Is that possible in your case? If so, read this tutorial: https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript

If not, what you can do is prompt the user to save the file using a specific name and not submit it until they do.

Translate
GeorgeCFray
Known Participant
October 2, 2018

I would need the rename to also change the number (BOLD) within the email:

var theSubject = "ECR-X01 | " + this.getField("Dropdown3").value;

Translate
GeorgeCFray
Known Participant
October 2, 2018

Not sure what you mean by that... Based on what do you want to change it?

The basic code to use for the file-name is something like this:

var desiredFileName = "1.pdf";

if (this.documentFileName==desiredFileName) {

    // insert code to submit form here

} else app.alert("You must first save the file as \"" + desiredFileName + "\" before submitting it.",1);


I need to change the file name based on what is read within a specific folder.

If I had ECR-X001 to ECR-X394 I would like the send button to read the next number. provide the correct name for example, in this case, it would be ECR-X395 and then prompt to save, then once saved submit the ECR-X395 to my email string.

Translate