Avatar

Level 4

Niall, if the script works for you, we must be really close to a solution. It doesn't work here, but I've attached the files I used.

In LC on the Print Form button I have

----- topmostSubform.Page9.PrintButton1::click: - (JavaScript, client) -----------------------------

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);

//calls trusted function in MySaveAsPO.js folder-level script
event.target.myTrustFunct(event.target);;

and in the folder .js file I have

// folder level JavaScript to allow access to the identity object properties
trustedIdentity = app.trustedFunction( function (sProperty)
{
var iProperty = "";
app.beginPriv();
iProperty = identity[sProperty];
app.endPriv();
return iProperty;
});

// folder level JavaScript to allow Save As population of file name
mySaveAs = app.trustPropagatorFunction(function(myForm, path)
{
     app.beginPriv();
     var myForm = event.target;
     return rtn = dmaicForm.saveAs(path);
     app.endPriv();
});

myTrustFunct = app.trustedFunction(function(myForm, path)
{
     app.beginPriv();
     var proNr = event.target.xfa.resolveNode("topmostSubform[0].Page1[0].Last_Name[0]").rawValue;
     //console.println("proNr: " + proNr);
     var vProNr = proNr.toString();
     var vPath = "/c/HSSSave/HSS Foot & Ankle for Patient " + vProNr + ".pdf";
     //console.println("vPath: " + vPath);

     var retn = mySaveAs(myForm, vPath);

     app.endPriv();

     return retn;
});

Can you see what's missing? I created a folder HSSSave at the root of C:\ and shared it. I also copied into /c/Documents and Settings/All Users/Documents/HSSSave and still no PDF copy was saved in that location.