Skip to main content
Participant
May 28, 2024
Question

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

  • May 28, 2024
  • 2 replies
  • 1239 views

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!

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
May 29, 2024

Use:

app.execMenuItem("SaveAs");

Thom Parker
Community Expert
Community Expert
May 29, 2024
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often