Hi,
I'm using LiveCycle Designer ES2 and Acrobat X Pro. I'm trying to create a PDF form that will import and export data from an XML file - specifically, import upon opening the form, and export upon saving the form. The document will be very limited in scope so I have it certified. The users of the form also have the latest Adobe Acrobat. The users should not be aware of the importing and exporting - they are only going to be saving the document.
I was able to get the form to import the data successfully with the following code:
topmostSubform.Page1::docReady - (JavaScript, client)
xfa.host.importData("document_data.xml");
However, I cannot get this to work:
topmostSubform.Page1::preSave - (JavaScript, client)
xfa.host.exportData("document_data.xml");
When I save the PDF from Acrobat, nothing happens and the Javascript Debugger reads:
RangeError: Invalid argument value.
Doc.exportXFAData:-1:XFA:topmostSubform[0]:Page1[0]:preSave
I tried adding 0 as an optional second argument to the function that indicates the format is XML, but the problem was the same.
I also tried seeing what happened when I used FormCalc code, and a very vague message comes up when I try to recertify and save:
"Script failed (language is formcalc; context is xfa[0].form[0].topmostSubform[0].Page1[0])
script=xfa.host.exportData("document_data.xml")
Error: " [no error message]
If what I'm trying to do is impossible for whatever reason, another solution would be for the PDF to import the data only the first time it's opened, and then just keep any modifications saved within the PDF. This was actually the first thing I tried to do, but I couldn't figure out how to make that work without putting a button on the form (seems like a waste of space since the button would only be used once).
I'd greatly appreciate any ideas or advice!
Views
Replies
Total Likes
Try removing the file name from the method. So the user needs to provide a name.
xfa.host.exportData("",0);
You can save the changes made to the data to the PDF by checking the checkbox under Defaults tab of File menu -> Form Properties.
Preserve Scripting changes and set it to Automatically.
Thanks
Srini
Views
Replies
Total Likes
If you supply a filename (and path) to the exportData() method, you will need to certify the form in order to have it work. In this case, Preserving script changes cannot be automatic. saving a file silently is a secrity risk.
http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=001341.html
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies