Hi,
I am designing an interactive adobe form, on which I have a field for selecting a file from users hard drive.
My requirement is to save the adobe form on user computer automatically.
Currently, I am writing the below code in the click event of BROWSE button. In order to save the form automatically I am placing a javascript file on C:\Program Files\Adobe\Reader 9.0\Reader\Javascripts with the below code.
Code in JS file:
*************************************************************
trustedSaveAs = app.trustedFunction( function (pFileName)
{
app.beginPriv();
try {
var myDoc = event.target;
myDoc.saveAs(pFileName);
} catch (e) {}
app.endPriv();
});
*************************************************************
Code in Click event of BROWSE button:
*************************************************************
var sFile = "File1";
event.target.importDataObject(sFile);
var oFile;
oFile = event.target.getDataObject(sFile);
this.parent.parent.Sub_Form_Fields_Mass.ZPATH1.rawValue = oFile.path;
trustedSaveAs("/c/Program Files/Mass.pdf");
*************************************************************
This trustedSaveAs function is basically responsible to save the form on C drive.
I have two limitations in this:
1. I am creating the JS file automatically if it is not present on the user's machine. Since this file needs to be placed in JavaScript folder only, I am not able to determine its path at run time because it could vary on user's machine depending on the Adobe Reader's version installed on the machine. (e.g. Reader 8.0, Reader 9.0 and so on...). Please help me if I could place this file somewhere else, or how determine the Adobe Reader's version installed on user's machine.
2. If I try to save the form on C:/ (on the root node), it does not happen. I always have to save this form in some folder inside the C drive. I am not able to create a folder at run time where I can store this form. Currently, I am saving it in the Program Files folder assuming that this is available on all the computers running on Windows. Please help me with providing me the solution to save the form automatically.
First problem is very critical, if it is not solved there i no point in going ahead. Request you all to please give it a chance and provide me with the right catch.
Thanks in Advance,
Ashish
Do you have access to the computers of all the intended users of your form? I ask because you cannot automatically install a JS trusted function onto someone elses computer automatically- that is a security restriction.
Hope this helps,
Dimitri
WindJack Solututions
www.windjack.com
www.pdfscripting.com
Dimitri Munkirs
WindJack Solutions
pdfscripting.com