Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 655707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:38:02+00:00 2026-05-13T22:38:02+00:00

I was recently searching for a way to call the print function on a

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:38:02+00:00Added an answer on May 13, 2026 at 10:38 pm

    “postMessage” is essentially one half of a publish/subscribe model for JavaScript.

    You can post any message you like, but it relies on something listening for that message event. So your postMessage is essentially you throwing an event over the fence, hoping that something is waiting on the other side to do something with the event. On the other side of the fence is (hopefully) an event listener like this:

    window.addEventListener("message", doSomethingWithTheMessage, false);
    
    function doSomethingWithTheMessage(event) {
        alert("Do Something!");
    }
    

    More information here: https://developer.mozilla.org/en/DOM/window.postMessage

    In your specific example, when you embed an object such as a PDF, Flash or something along those lines, they may well listen for events in exactly this way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently searching for a 'technical article' I stumbled upon this Microsoft page: http://academic.research.microsoft.com/ .
Recently I was searching on how to secure svn repository, or otherwords how to
Ive recently started using CodeIgniter as I was searching for a very lightweight framework
I've recently run into an issue that no amount of online searching seems to
Recently the PHP manual started showing the following warning on every mysql function page:
I'm using Solr for searching, and recently started using faceting to allow users to
Recently I have encountered an issue with Scribd where searching via Scribd API (docs.search)
I recently used a nice little jquery script that loads images with a given
Recently I was searching for icons(graphics), but I see a link that was very
I've been searching and reading up on SignalR recently and, while I see a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.