Highlighted

XML data binding works in preview, but not in Reader

Avatar

Guest

12-11-2008

I have made a form that is bound to a single XML file, where a subform can appear multiple times when there are multiple bound data elements.



This works very well in LiveCycle's preview---the subform indeed appears multiple times with each data element appearing in an instance of the subform.



The end users, of course, have Adobe Reader. And when I try to load the same form in Reader, there seems to be no data binding to the XML file, and I cannot find a way to establish it. What am I doing wrong?



Reader can write manually entered data into an XML file. This means that it must be able to re-read that file, in case the user wants to correct something or add more data later. But I have not found how to do it. What am I overlooking?



I've tested with Adobe Reader 8.13. Could that be the reason? Do I need version 9? I'm hesitant to install 9, because I need to test with 8, and that is already awkward with Acrobat and LiveCycle also on the same computer.



Hans-Georg

Replies

Highlighted

pguerett

12-11-2008

You have not saved the form as a dynamic PDF but you are Previewing it as one. Open the form in Designer and hit the File/SaveAs choose Adobe Dynamic PDF in the Save As Type dropdown.
Highlighted

Avatar

Guest

12-11-2008

Paul, thanks, but I did save it as a dynamic PDF file. It still doesn't work.



Please note that I can make it work in Adobe Acrobat 9, but only with manual intervention. If I select Forms, Form data ..., Import data and select the XML file, I do get the complete data view with the repeating subform.



But Adobe Reader doesn't have any such command, and in fact I would prefer that the end user doesn't have to enter such commands anyway. I would much prefer that the PDF file automatically swallows the XML file from the same folder with a hard-coded name, exactly as it works in the LiveCycle Designer preview. But currently I can't make it work at all in Adobe Reader 8.1.3. If you ever had this work, which version of the Reader was that?
Highlighted

pguerett

12-11-2008

The form is reating to the data. When you load the form there is no data present so the form is not dynamic. You can add a button to load the data on the form or you can have the data merged server side before the form is rendered (this required server based software called LiveCycle Forms.



Your other option is to save form and data together (do not to a data save but a complete PDF save). To do this in Reader you will have to extend your file in Acrobat first.
Highlighted

Avatar

Guest

12-11-2008

Paul, thanks again! I think that will do nicely. Do you know off-hand what command the button has to use to load the XML data file? I wasn't aware that Javascript actions can access the local hard disk. (Sounds as if PDF is the next big computer virus vector. 🙂 )



Do you think that it may be possible to load the data automatically through some Javascript that is executed directly after the form is loaded?
Highlighted

pguerett

12-11-2008

You cannot load it automatically unless you certify the document and that has a lot of other connotations to it.



You can use the



xfa.host.importData()



command and that will bring up a dialog for the user to choose the file they want to load.
Highlighted

Avatar

Guest

13-11-2008

Great, thanks! However, I'm running right against the next wall: "NotAllowedError: Security settings prevent access to this property or method."



As I meanwhile expect from Adobe, the documentation does not contain any hint at any required security settings. It only says that, if you use the importData(param) method, then the document has to be certified, but if you use it without param, then certification is not needed. I'm left without any clue at which security settings Adobe wants me to set.



Guess I keep needing your help. 🙂
Highlighted

pguerett

13-11-2008

That is the certification I was referring to. Do not pass a paramater and your user will be prompted to choose the file. If you certify the PDF you will need a certificate and that certificate will have to be in every users trusted store.