I was recently searching for a way to call the print function on a PDF I was displaying in adobe air. I solved this problem with a little help from this fellow, and by calling postMessage on my PDF like so:
//this is the HTML I use to view my PDF
<object id="PDFObj" data="test.pdf" type="application/pdf"/>
...
//this actionscript lives in my air app
var pdfObj:Object = htmlLoader.window.document.getElementById("PDFObj");
pdfObj.postMessage([message]);
I've tried this in JavaScript as well, just to be sure it wasn't adobe sneaking in and helping me out...
var obj = document.getElementById("PDFObj");
obj.postMessage([message]);
Works well in JavaScript and in ActionScript.
I looked up what the MDC had to say about postMessage, but all I found was window.postMessage.
Now, the code works like a charm, and postMessage magically sends my message to my PDF's embedded JavaScript. However, I'm still not sure how I'm doing this.
I found adobe talking about this method, but not really explaining it:
HTML-PDF communication basics
JavaScript in an HTML page can send a message to JavaScript in PDF content by calling the postMessage() method of the DOM object representing the PDF content.
Any ideas how this is accomplished?