In this video, I'm going to show how you can save your PDF form with the new filename of the PDF based on the text field data via Action button javascript.
PDF form, when a user saves the document can anybody share a javascript that would generate the filename of the document based on the data in a form field within the form and for this document to be saved in a separate directory from the original PDF.
Just paste and change text field name.
Button JavaScript:
var myFileName = this.getField("Name").value + this.getField("Text1").value + this.getField("Text2").value + ".pdf";
Folder Level Script:
mySaveAs = app.trustPropagatorFunction(function(doc,path) {app.beginPriv(); doc.saveAs(path); app.endPriv(); })
myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path) {app.beginPriv(); mySaveAs(doc,path); app.endPriv(); });
myFileName = "/c/temp/" + myFileName
myTrustedSpecialTaskFunc(this, myFileName);
NOTE:
After putting the javascript in SAVE button, restart your adobe acrobat.
Make sure you have created a new folder in drive C and name it "temp".
You can add multiple fields by adding this string in button javascript
this.getField("Nameyourfieldhere").value +
Ещё видео!