I think you will need some kind of headless browser to execute the JS on 
the server. Maybe something like 
https://github.com/ryanpetrello/python-zombie or 
http://code.google.com/p/py-webkit-html-manipulator/.

Anthony

On Friday, June 29, 2012 5:06:20 PM UTC-4, Andrew wrote:
>
> Hello, 
> I have been using the wonderful d3 library with web2 py.  See 
> http://d3js.org/ for more information.  But it is aimed at the browser. 
>  It is great to visualise json output from web2py.
>
> One thing it does is generate svg content.  I would like to be able to 
> generate a png image from the svg definition, but on the server.  I know 
> it's possible with phantom.js and node.js (from another group: 
> https://groups.google.com/forum/m/?fromgroups#!topic/d3-js/XHbidy5pY8A), 
>  but I'm not sure if they fit into a web2py context,  or if that is the 
> right approach with web2py.  Does something like a "Headless web kit 
> browser" fit into web2py approach?
> .
> I'm wondering is it possible, using something like response.render to 
> generate the svg in a controller and generate a png image (which I could 
> save or include in PDF output).  Would I include these other libraries, but 
> where, in the view?  
>
> Anyway, I think d3 is fantastic and it would be great to be able to 
> exploit it (more!) in web2py.  Happy to put up some simple examples that 
> show how to do it (the browser part at least) 
>
> Thanks
>
>

Reply via email to