Expand my Community achievements bar.

Unable to communicate from HTML/JS to PDF

Avatar

Level 2

Hi,

I created a PDF Form in LC Designer and need to enable bidirectional communication between the PDF and the JS in the HTML page the PDF is embedded into. Sending messages from the PDF to JS works just fine, e.g. the PDF can send messages using hostContainer.postMessage() and I can successfully handle these in  JS. However, posting messages from HTML/JS to the PDF fails.

From within the PDF (in the main form initialize event) I do:

  var doc = event.target;

  doc.disclosed = true;

  doc.hostContainer.messageHandler = {onMessage: myMessageHandler, onError: myErrorHandler, onDisclose: function() {return true}};

but as soon as doc.disclosed = true gets called, an Error is thrown:

  NotAllowedError: security settings prevent access to this property or method

So... sending messages from PDF to HTML/JS works fine. The other way round does not work as I already fail to mark the PDF form (or technically the document) as disclosed.

Any ideas?

Thanks,

Dirk

0 Replies