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

Use this Scrip in button , Its says error please help

Community Beginner ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

// get the value of the form field var text1Value = this.getField("OrderNumber").value;

// here you need to make sure that no illegal characters are used, and also that text1Value is not empty

// make a file name from the field value var newFileName = text1Value + ".pdf";

// get the path where the file is currently located var filePath = this.path.replace(this.documentFileName);

// create the new full path var newFullFilePath = filePath + newFileName; try { this.saveAs(newFullFilePath);

// Only this will not work from a button... } catch (e) { app.alert("Error! Could not save as: " + newFullFilePath); }

TOPICS
Acrobat SDK and JavaScript , Windows

Views

500

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 ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

- Post the code with normal formatting.

- Drop the try-catch clause and report the full text of the exception.

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 ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

Also, we told you already you can't do it without a script that's installed on the local machine. You're wasting your time.

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 ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

I Instated java in my machine properly.

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 ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

Java is not JavaScript, and vice-versa.

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 ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

This line:

var filePath = this.path.replace(this.documentFileName);

would makes sense if you were to change it to this:

var filePath = this.path.replace(this.documentFileName, "");

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 ,
Sep 25, 2018 Sep 25, 2018

Copy link to clipboard

Copied

LATEST

You might want to look at How to Save a PDF with Acrobat JavaScript by Thom Parker from 2010. Quite old but the script still works as written, you just have to adjust for the revisions in the location of the user Acrobat JavaScript folder if you use the user's folder.

Unlike a executable line of code that end with a semi colon, comments only end with a new line. You posted code will not work without some editing.

doc.saveAs()

The trusted function was introduced in Acrobat 7.0.

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