Copy link to clipboard
Copied
Dear All,
I would like to save my acrobat form as FDF.
Through the code I found on this forum, I am getting error during saving the fdf file. Seeking your help about how to change the JavaScript code for this purpose?
Thanks in advance for your help.
Folder level javascript for Trusted Function
var myExportFDF = app.trustedFunction(
function(oDoc, cPath, cFlName) {
cPath = cPath.replace(/([^/])$/, "$1/");
try {
app.beginPriv();
oDoc.exportAsFDF({cPath: cPath + cFlName})
app.endPriv();
} catch (e) {
app.alert("Error During Save - " + e);
}
}
);
Folder level javascript for Date
function myDateString() {
return util.printd("dd_mm_yy", new Date());
}
Script for Button in Acrobat form
var directory = "/Users/Me/Onedrive/Documents/FDF/"
if (typeof(myExportFDF) == "function") {
myExportFDF(this, directory, this.getField("Reg").value + myDateString() + ".fdf");
} else {
app.alert("Missing Save Function. Please contact forms administrator ");
}
When click the button it ends up with an error.
I have tried my best to find out the solution but failed. Now seeking for your kind help.
Thanks again!
Then you need to start debugging the code. For example, use a simpler file name, such as "1.fdf", instead of the one you currently use. If that works, the issue is probably with the value of the field, etc.
Copy link to clipboard
Copied
Are you able to do it manually, without the use of a script?
Copy link to clipboard
Copied
Yes i can do it manually. Prepare form > More> Export Data>. It saves as fdf & opens correctly.
Copy link to clipboard
Copied
Then you need to start debugging the code. For example, use a simpler file name, such as "1.fdf", instead of the one you currently use. If that works, the issue is probably with the value of the field, etc.