These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How to pass a variable data from acrobat javascript to flex?

prakash philip
Registered: Nov 25 2009
Posts: 7

Hi,
Am having one Flex application in which am calling PDF files by embedding pdf in one html page.
I am able to pass comments from flex to pdf by using post message method.
Now my requirement is to get the page number of pdf file. it can be achieved by using pageNum.
I want that page number to display in my flex application.
can anyone please help me to sort out this problem with some little code....
Regard,
Philip.

My Product Information:
Acrobat Standard 9.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Do you mean that you are using the HostContainer interface in Acrobat? If so then JavaScript in the PDF file can also post messages to a callback function in the HTML JavaScript. Send a message to the PDF JavaScript asking for the page number, then use the "postMessage" function on the PDF side to send the page data back to the HTML. I haven't tried this, but if there are problems calling postMessage() directly from the message handler in Acrobat JS, then place the post back code in a timeOut call to do it indirectly.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
Thom's solution should work, but remember that many people (especially now we're in under a security alert) will have Javascript turned off in their copies of Reader and Acrobat, so anything you do in Flex will need to fail gracefully if the PDF refuses to respond.