Qt and Flash in a headless environment

  • I am using phantomjs (http://www.phantomjs.org/) to try to generate a PDF from a web page. If you are not familiar with it, phantomjs is a headless browser driven by Javascript, capable of rendering HTML pages in several formats. Unfortunately, the flash content is not rendering.

    Some preliminaries:
    phantomjs version: 1.1.0
    Qt version: 4.7.4
    System: Windows XP SP3

    I've been struggling with this for some time, so I downloaded the Qt source and built it for Windows. After a couple of days, I finally got an environment where I can debug phantomjs and QT.

    Looking at the Gecko NPAPI documentation, I found the following tidbit (https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/Drawing_and_Event_Handling)

    "Before it can repaint or refresh part of its drawing area, a windowless plug-in must first invalidate the area with either of these browser methods: NPN_InvalidateRect or NPN_InvalidateRegion. Both methods perform the same operations:

    •They invalidate the specified drawing area prior to repainting or refreshing.
    •They pass an update event or a paint message to the plug-in.

    The browser redraws invalid areas of the document and windowless plug-ins at regularly timed intervals. To force a paint message, the plug-in can call NPN_ForceRedraw after calling one of the invalidate methods. If a plug-in calls one of these methods, it receives a paint message asynchronously. "

    I was able to set a breakpoint in the NPN_InvalidateRect method, and follow it through to the end of its processing. I see the invalidation occur, but I don't see a paint message being sent back to the plugin, or a call to NPN_ForceRedraw. In a headless environment, I don't believe a WM_PAINT will be sent "at regularly timed intervals", so the NPN_InvalidateRect should be calling NPN_ForceRedraw, should it not?

    Anyways, I think this is the root of the problem, but I'm just not sure. Can anyone verify or dispute my conclusion? Is anyone able to render Flash content in a headless browser on Windows? Perhaps phantomjs, as a headless browser, should be doing something that it isn't?

    Any help would be very much appreciated.


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.