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

Communication between browser and PDF

ekschperte
Registered: Jun 12 2010
Posts: 29

Hello,
 
is there a way to achieve a communication between a pdf embed in a website and the browser's javascript?
I have a flash application running in a pdf and I am trying to embed the PDF in a html website. A click on a hyperlink in the flash file should then open the browser's alert()-function for example.
 
Is that possible? If so, can you give me example codes?
Greets

My Product Information:
Reader 10.0.1, Windows
UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
Yes it's possible - kindof - but you have to get there in two stages and it's far from reliable.

First you need a utility function at document level which communicates with doc.hostContainer using the message handler functions. Then your Flash code can call your doc-level function via ExternalInterface.

Note that the hostContainer object isn't present on Mac systems or when a PDF is viewed in desktop mode, and calling into a dead object can cause fun when you're expecting asynchronous responses - so always check the hostContainer object isn't null before using it for anything, and be prepared to handle missing responses.

Look in the JS API docs for examples, under HostContainer.