Expand my Community achievements bar.

javascript problem for form created in Adobe Designer 8.2

Avatar

Former Community Member
I have redesigned the form using Adobe LiveCycle Designer 8.2 and tried to do merging of xml values into the form. But not successful. Below is sample of the javascript



trustedImportXFAData = app.trustedFunction (

function (xmlfilenamename)

{

app.beginPriv();



var re =".pdf";

var filename = this.path;

this.importXFAData(xmlfilenamename);

this.saveAs(filename);

this.closeDoc();

app.endPriv();

}

)



This code works find with form created in previous version but not in the new version. I believe it has something to do with the privilege but I do know where I should change.

For you information, I don't get any error from javascript.

Thank you



}
7 Replies

Avatar

Former Community Member
To be able to load a data file into the system programmatically you wil have to certify the PDF. When you certify you have to choose the allow scripting option. Once that is done each user will have to put your certificate that you used to certify into their trusted store.



Just putting the code into a trusted function is not enough.

Avatar

Former Community Member
Hi Paul Guerette,



Thank you for your advice. I'm new to all this. Hope you could direct me to certain documentation where I could learn of how to create cert for PDF and also deploy it to the user. In this case I'm the user. I'm testing this with 2 different laptops.



Please advice. I appreciate your help.

Thank you

James

Avatar

Former Community Member
I also add in app.alert in the js to see if the code is being executed.

I noticed that the alert before "this.importXFAData(xmlfilenamename)" works fine but the app.alert below does not get executed.

So as you said, this could be due to the cert.



Please help. Thank you



James

Avatar

Former Community Member
Hi Paul Guerette,



I just remembered. I better inform you this as well so you can see the real picture.



Desktop - OS / Vista Home

I created the PDF form using Acrobat Livecycle ES 8.2, Then I opened the form in Acrobat Professional 9.0 to enable the save features. Then I open in Reader 9 to make I will be able to save data. Successful



Laptop - OS / XP Professional

I have vb.net that calls the js passing xml as parameter.

jsCode = "trustedImportXFAData(""" + SOURCE_XML + """);"

Fields = formApp.Fields

Fields.ExecuteThisJavaScript(jsCode)



In this machine I have Adobe Acrobat 7.0 Professional. The javascript is inside the \Acrobat 7.0\Acrobat\Javascript\.



I wonder could this also be, because of the compatibility between 2 different versions.



Thank you

Avatar

Level 4
You can see what compatibility issues there will be by setting the default version used in Livecycle Designer by going on the menu to:

File > Form Properties



From this then choose the "defaults" and change the target version to version 7.



Then open the report window by going on the menu to:

Window > Report



Here it will give you a lsit of all the compatibility issues with that version.



Tom

Avatar

Former Community Member
If you hit Ctrl-J you will get the java console come up and I bet you will see a security error when running your script. This will cause your script to stop executing.

Avatar

Former Community Member
Hi Tom



I did changed as you mentioned but again it could not work.



Hi Paul,



I could not run the debugger by pressing Ctrl-J. I run the application from vb.net. I do not know where i should do that.



I opened the form using adobe designer 7. After opening and saving again. I test the application. Now the js code works.

But if i create the form using designer 7, I could not save data manually using Acrobat Reader 9.

Please advice. Is there any option for forms created using version 7 to be opened by Reader 9 and be allowed to key data and save them manually?



Thank you