Hello there,
please help me with this issue.
I want to have "Save as" button, when I click it rename file name in specific field entry name( rawValue ) and Save it silently with massage box.
Tried as much I can learn, because I have no clue with js coding. I understand that part with js file in Adobe JS folder, but have to put wright code.....
Thx in advance.
Files: https://mega.nz/#!OQQSAAZS!N0coQsfr6XVr7WdyPGvKwo0b1OuFicy5Qc7kjLjRF7E
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
if you're using an XFA form, then you just need to take over the scriptings from the sample form you can download from my blog.
The script I've posed earlier doesn't work with XFA forms as the syntax is especially for static AcroForms, so forget about it.
Views
Replies
Total Likes
Nobody?
Views
Replies
Total Likes
Looks like you're using an AcroForm indstead of an dynamic XFA form.
You can recycle my solution for XFA forms to use it in AcroForms to.
All you need is to install the Folder Level Script from my solution into you Acrobats JavaScript folder and to add a button in your AcroForm that executes a JavaScript:
var cDefaultName = "LCB_SaveAs_AcroForm_v3_en.pdf", //The default name of the form (before it is saved by the script)
cDirectory = this.path.replace(this.documentFileName, ""), //The current directory
cSeparator = "_", //A Separator for spaces or invalid characters in file names
cSavePath = cDirectory.concat(this.getField("FileName").value.replace(/\.pdf$/g, "").replace(/[\s\!\?\<\>\'\"\*\/\\\=\?\^\`\{\}\|\~]+/g, cSeparator)).concat(".pdf"); //The save path
if (cSavePath) {
lcbSave (this, cSavePath, this.documentFileName, cDefaultName);
} else {
app.alert({
cMsg: "Please enter a name for the file first.",
cTitle: "Can't save form!",
nIcon: 0,
nType: 0
});
}
Sorry, I can't upload a sample file, Adobe's cloud thinks my AcroForm-sample file contains a virus for some reason?!
Anyway, you should be able to get it work with the script above!
Views
Replies
Total Likes
Views
Replies
Total Likes
Nope, I cant understand what should I change, with what, etc.
Views
Replies
Total Likes
Did you check my sample? LiveCycle Blog: Formulare mit neuem Namen in bestimmtes Verzeichnis speichern//Save forms with new n...
It contains everything you need.
Views
Replies
Total Likes
Of course. I know that is right solution...
I just don't know how to name my file, what to replace in yours codes, rename in yours codes, etc....
Views
Replies
Total Likes
function lcbSave (vDoc, vPath, vCurrentName, vDefaultName) {
if (vCurrentName === vDefaultName) {
try {
event.target.lcbSaveAs(vDoc, vPath);
xfa.host.messageBox("File was saved under:\r\r" + vPath.toUpperCase(), "File Saved", 3, 0);
xfa.form.execInitialize();
} catch (error) {
xfa.host.messageBox(error.toString().replace("RaiseError: ", "") + "\r\rEnsure the destination folder exists and there isn't already a file with the same file name in that folder!\n\n" + error, "Failed to save file", 0, 0);
}
} else {
app.execMenuItem("SaveAs");
}
}
Mine situation in pictures and JS code which is in Adobe JS folder.
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi,
if you're using an XFA form, then you just need to take over the scriptings from the sample form you can download from my blog.
The script I've posed earlier doesn't work with XFA forms as the syntax is especially for static AcroForms, so forget about it.
Views
Replies
Total Likes
Hello,
I used your expamle files. It helped me, but I still have a problem.
I need to create a button in static PDF form, which will always save PDF to C:\Tmp\toPrint and the file name will be taken from field "barCode" from the form.
I finaly able to display the path to new file, but the button does not work.
You can download my files at http://www.uschovna.cz/zasilka/HTUK8VMMEU62PF87-7IV/
Can you help me with this please?
Thank you very much.
David
Views
Replies
Total Likes
Hi David,
you forgot to copy the script object "Utils" from my sample into your form, so the function call in you save button points to nowhere.
Anyway, you can get it work easily.
Just replace the buttons current script with:
function lcbSave (vDoc, vPath, vCurrentName, vDefaultName) { |
if (vCurrentName === vDefaultName) {
try {
event.target.lcbSaveAs(vDoc, vPath);
xfa.host.messageBox("File was saved under:\r\r" + vPath.toUpperCase(), "File Saved", 3, 0);
xfa.form.execInitialize();
} catch (error) {
xfa.host.messageBox(error.toString().replace("RaiseError: ", "") + "\r\rEnsure the destination folder exists and there isn't already a file with the same file name in that folder!\n\n" + error, "Failed to save file", 0, 0);
}
} else {
app.execMenuItem("SaveAs");
}
}
lcbSave (event.target, pathToNewFile.rawValue, event.target.documentFileName, "test.pdf");
Views
Replies
Total Likes
Views
Likes
Replies