Access PDF's script variables

Is there a way to access Javascript objects exist in a PDF file from an external code, I’m trying to access JS variables in a PDF file that is embedded in a web form as an IFrame, I would like to access these variables from the webform JS code.


1 Solution
Solution

It’s possible if the PDF allows it. I’ve written a book about PDF and it contains a section about establishing Javascript communication between HTML and PDF. You can find the text of this section here: http://www.javabeat.net/2011/04/javascript-communication-between-html-and-pdf-in-itext/

Note that this doesn’t work on all OSSs. The PDF needs to access its host container and you need to use a message container.

If your PDF doesn’t have an onMessage() function nor a message handler, you can’t establish any communication.