Expand my Community achievements bar.

SOLVED

Save PDF Silently on network drive and file name construct based on Invoice No and Customer Name

Avatar

Level 2

I am trying to save a file on pre-Print ( I will change this to PostSign event as currently theres no dongle with me to test ) event. I am failed to save file silently or in foreground!!. I have written following code.  I am requesting you to kindly help me to understand where I am making mistake. I will appreciate your help in this manner greatly.  For your information I am using Adobe Live Cycle Designer to make Adobe print based pdf form for SAP Applications. 

 

Code :

I have put Config.js in the /Reader/.../Javascripts directory with below code:

mySaveAs = app.trustPropagatorFunction(function(doc,path) {
app.beginPriv();
doc.saveAs(path);
app.endPriv();
})

myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path) {
// Privileged and/or non-privileged code above
app.beginPriv();
mySaveAs(doc,path);
app.endPriv();
// Privileged and/or non-privileged code below
});

I have written below code in Javascript Editor for Live cycle designer in under prePrint

data.master_page.Page1.#subform[6]::prePrint - (JavaScript, client)
//app.execMenuItem("SaveAs");
var myFileName = data.master_page.Page1.Address_details.Rec_del_add.SO_NAME1 + 
                 " - " + 
                 data.master_page.Page1.Address_details.Inv_dtls.VBELN +
                 .pdf";                 
// add folder name
myFileName = "/c/Users/archit.p/Desktop/Sanathan E-Invoice/From Form/" + myFileName;
myTrustedSpecialTaskFunc(this, myFileName);
this.closeDoc() ;

I even tried  by putting app.alert to see is there any value in myFileName ? but alert is also not working. 

only

app.executeMenueItem(SaveAs);

is working but this is not serving my purpose.  

 

Thanking you!

Best Regards

Naim

1 Accepted Solution

Avatar

Correct answer by
Employee

I can see one problem in your XFA based scripting:

The AcroJS this is not the same as the this in XFA scripts. Your this.closeDoc() will not work. You would have to use event.target instead. Same in the function call.

See this League entry describing and explaining this:

https://experienceleaguecommunities.adobe.com/t5/adobe-livecycle-questions/passing-a-document-to-a-t...

 

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

I can see one problem in your XFA based scripting:

The AcroJS this is not the same as the this in XFA scripts. Your this.closeDoc() will not work. You would have to use event.target instead. Same in the function call.

See this League entry describing and explaining this:

https://experienceleaguecommunities.adobe.com/t5/adobe-livecycle-questions/passing-a-document-to-a-t...