Copy link to clipboard
Copied
Hello,
I have read through few discussions and can't seem to find a javascript that lets you save pdf in current folder. Everyone asks for it to be saved in a specified folder.
So, I was wondering if there is a javascript that can save the PDF in folder that the PDF is currently in named after two fields in Adobe Form.
Thanks!
1 Correct answer
Sure, that's possible.
You can use something like this to do it:
var newFileName = this.getField("Text1").valueAsString + "-" + this.getField("Text2").valueAsString + ".pdf;
this.saveAs(this.path.replace(this.documentFileName, newFileName);
Copy link to clipboard
Copied
Sure, that's possible.
You can use something like this to do it:
var newFileName = this.getField("Text1").valueAsString + "-" + this.getField("Text2").valueAsString + ".pdf;
this.saveAs(this.path.replace(this.documentFileName, newFileName);
Copy link to clipboard
Copied
This is probably a case of the carpenter blaming his tools, but I wondered has anything changed in Adobe since this answer.
When I run it I get "NotAllowedError: Security settings prevent access to this property or method...." in the console. In addition I have copied other scripts dealing with saving PDFs and have frequently gotten this message.
Stay safe
Thank you.
Copy link to clipboard
Copied
You need a trusted function. Read this:
https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript/
Copy link to clipboard
Copied
Mr. Alheit
Thank you. Thank you. Thank you. I can stop butting my head against a tree
I have build a program (ExpungeKY.com) where users (total strangers or their lawyers) can get a form, fill it out, save it and later use it to expunge a criminal record. If I understand you correctly, there is no realistic way for me to have the file already be named, for example, "Jones-12345" when the user saves it.
A person usually needs several different forms. My biggest number has been 40, but 6-10 is not unusual. I just thought it would help the user keep things straight if the files automatically came with a unique name. Of course the user can name the file the old fshioned way-- retype it. No big deal. Just a convenience.
I do a fair number of these forms myself. I assume there is a way to put this feature in a separate set of forms just for use only on my own cmputer. Is that a big deal?
Again thanks and stay safe. If you need to charge me to answer this, let me know. Jwp@aye.net.

