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

Use this Scrip in button , Its says error please help

Community Beginner ,
Sep 24, 2018 Sep 24, 2018

// 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
614
Translate
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

- Post the code with normal formatting.

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

Translate
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

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.

Translate
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

I Instated java in my machine properly.

Translate
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

Java is not JavaScript, and vice-versa.


Acrobate du PDF, InDesigner et Photoshoptographe
Translate
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

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

Translate
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
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.

Translate
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