Highlighted

Retrieve data from PDF via Javascript

Avatar

Guest

23-06-2008

Hello,



is there a way to retrieve data from PDF (generated by LC Forms out of XDP, with XML Data mapped in, as well as fragments) via Javascript? The pdf will shown with Adobe Reader inside Internet Explorer. Setting values works fine.



But I never saw a method retieving data from it, only returning void (by design, sandbox problem?).



Regards, Leo

Replies

Highlighted

pguerett

24-06-2008

If I understand you correctly you want to programmatically save the xml data that is in a form?



If so the command is:



xfa.host.exportData();



This will bring up a dialog and allow you to select a file and destination for the xml data file.
Highlighted

Avatar

Guest

24-06-2008

Paul, thanks for your answer.



But I need it in another way. I manipulate PDF Elements from an outside application via Javascript (Flex, Javascript via IEXplorer Runtime). To do that, my PDF is injected with an Listener to react for calls from Javascript via postmessage(). Now, I need to prepare a method for returning a datastructure (like your XML mentioned above, but containing all formular elements, e.q. as seen in the hierarchy of LC Designer).



I think the problem can be reduces to Javascript question: how to retrieve data back via javascript, quasi a readData() as counter piece of Javascript's postmessage().



Or, totally different - is there a LC Forms Server Service available which can be used to retrieve the scheme of an XDP-File in the LC repository?



Does anybody has any ideas, for readData or Forms Service?



Regards, Leo
Highlighted

pguerett

24-06-2008

Ok now I understand .....you can do an xfa.form.saveXML() and this will return the data dom in its current state. I generally will put this into a hidden field then have the external program ask for the value of the hidden field.
Highlighted

Avatar

Guest

25-06-2008

Thanks for your hint, I will try it out ...



But: how to access these value from DOM by an external program, especially Javascript (Adobe Reeader runs embedded within IExplorer), postmessage() will only be able to set values on target PDF, not to read data from target .. ?



Regards, Leo
Highlighted

Avatar

Guest

08-07-2008

Hello,



see above: The pdf will shown with Adobe Reader inside (that means, embedded) Internet Explorer. How to I access these Javascript environment of that IExplorer (call Javascript from inside of a PDF)?

Are there any event listener around within IExplorer's javascript container?



Regards, Leo
Highlighted

pguerett

10-07-2008

If you are trying to access the individual objects of the PDF from inside of the Javascript of an HTML wrapper I do not believe you can do that (for security reasons). You can use a messaging object and pass messages between the two environments. By passing a message into the PDF you could act on that message (execute some javascript in the PDF) to do what you and return back the results to your wrapper.



Look in the Acrobat javascript reference for the embedded PDF Object that will describe the message handler.
Highlighted

_SekharN_

16-07-2008

Leo,

This is interesting, though it is not the requirement I am working at this time it will help if you can post your finding and results. Also appreciate if you can more details about inserting Listeners.



Thank you,