Issue with this.saveAs() Function in Adobe Acrobat JavaScript
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
Read this:
https://www.pdfscripting.com/public/How-to-Save-a-PDF-2.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Use:
app.execMenuItem("SaveAs");

