Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Retrieve data from PDF via Javascript

Avatar

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

Avatar

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

Avatar

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

26-06-2008

Why can't you post a message back with the reults that you want?

Avatar

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

Avatar

Avatar
Level 5
_SekharN_
Level 5

Likes

0 likes

Total Posts

246 posts

Correct Reply

0 solutions
View profile

Avatar
Level 5
_SekharN_
Level 5

Likes

0 likes

Total Posts

246 posts

Correct Reply

0 solutions
View profile
_SekharN_
Level 5

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,

Avatar

20-07-2008

Hello,



I gave up returning values due "security reasons", see above.

😞



Regards, Leo