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

Oct 02, 2018

Copy link to clipboard

Copied

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!)

TOPICS
Acrobat SDK and JavaScript, Windows

Views

131

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

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

Oct 02, 2018

Copy link to clipboard

Copied

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!)

TOPICS
Acrobat SDK and JavaScript, Windows

Views

132

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
Oct 02, 2018 0
Oct 02, 2018

Copy link to clipboard

Copied

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.

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...
Oct 02, 2018 2
Oct 02, 2018

Copy link to clipboard

Copied

Due to the way our system works. I'm afraid not they are not on local machines. I think the prompt would be the best option.

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...
Oct 02, 2018 0
Oct 02, 2018

Copy link to clipboard

Copied

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

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

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...
Oct 02, 2018 0
Oct 02, 2018

Copy link to clipboard

Copied

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

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...
Oct 02, 2018 1
Oct 02, 2018

Copy link to clipboard

Copied

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.

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...
Oct 02, 2018 0
Oct 02, 2018

Copy link to clipboard

Copied

Without installing a script in each file, as well as on the local computer, it's not possible to do that.

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...
Oct 02, 2018 0
Oct 02, 2018

Copy link to clipboard

Copied

Not sure what you mean by "not on local machines". If you mean these are machines belonging to random end users in different companies, that would make sense, but since you are proposing to save the file, I assume the machines are all in a company?

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...
Oct 02, 2018 0
Oct 02, 2018

Copy link to clipboard

Copied

They belong on a server. although the physical machines are local, everyone logs on to a base server and works through a cloud-based workspace. I've sold the save as script to work. so the problem has gone away! Thanks again

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...
Oct 02, 2018 0