I’ve been snowed under with other work but I’ve now been able to look at this again and have some more info on how this can be achieved.

The major problem is that we can create the canvas content and capture it’s output from a non-browser environment. I’ve discovered the rather lovely envjs library that creates a browser DOM in pure javascript – you can even target different browser implementations. In conjunction with Rhino, it allows you to run browser javascript on the server.

All we need to do now is emulate the canvas context object as a Java object that creates images – I’m tracking down a library as we speak. This means that the following should work;

a) Design a rich HTML page with PD4ML tags within it and Canvas graphics
b) Create a Rhino instance and add to it the envjs and a Canvas context emulator
c) Run the HTML page through Rhino using an HTML parser and capture the resulting cavas images localy
d) Run the HTML through PD4ML using the new canvas hook which returns the appropriate image from step c)

Sounds like a lot, but actually I think this is pretty straightforward from a servlet point of view
Anyone done this yet?