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

Issue with this.saveAs() Function in Adobe Acrobat JavaScript

New Here ,
May 28, 2024 May 28, 2024

Hi everyone,

I am trying to prompt the user to save a PDF with a new name and location immediately after the document is opened using the this.saveAs() function. However, I am encountering an error that says TypeError: app.saveAs is not a function and Error: NotAllowedError: Security settings prevent access to this property or method.

Here is the JavaScript code I am using:

 

function promptSaveAs() {
try {
console.println("Prompt Save As function called");
this.saveAs();
} catch (e) {
console.println("Error: " + e);
}
}

app.setTimeOut("promptSaveAs();", 1000);

 

I have enabled JavaScript in Adobe Acrobat's settings, but the error persists. I would appreciate any help or guidance on how to resolve this issue or any alternative methods to achieve the same result.

Thank you!

TOPICS
JavaScript , PDF forms
751
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 ,
May 28, 2024 May 28, 2024

Read this:

https://www.pdfscripting.com/public/How-to-Save-a-PDF-2.cfm

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
May 29, 2024 May 29, 2024
LATEST

Use:

app.execMenuItem("SaveAs");

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