• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

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

482

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
community guidelines
Community Expert ,
Oct 02, 2018 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.

Votes

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
community guidelines
Community Beginner ,
Oct 02, 2018 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.

Votes

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
community guidelines
Community Beginner ,
Oct 02, 2018 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;

Votes

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
community guidelines
Community Expert ,
Oct 02, 2018 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);

Votes

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
community guidelines
Community Beginner ,
Oct 02, 2018 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.

Votes

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
community guidelines
Community Expert ,
Oct 02, 2018 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.

Votes

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
community guidelines
LEGEND ,
Oct 02, 2018 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?

Votes

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
community guidelines
Community Beginner ,
Oct 02, 2018 Oct 02, 2018

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines